-
Notifications
You must be signed in to change notification settings - Fork 856
Forms: Use components for trash/spam header CTAs in wp-build dashboard #46695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
ada2dcb
d6162f2
642035a
0ee6d5b
8808909
7e7d40f
b37d53f
175f4eb
e72b9f2
a2978dc
427d027
bd7b6d5
e2ad966
c0cdf95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
| Significance: minor | ||||||
| Type: changed | ||||||
|
|
||||||
| Use components for empty actions in trash/spam for new wp-build dashboard. | ||||||
|
||||||
| Use components for empty actions in trash/spam for new wp-build dashboard. | |
| Use components for empty trash/spam buttons in wp-build dashboard. |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog entry should end with a period according to the project's changelog guidelines.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,13 +26,16 @@ import * as React from 'react'; | |||||||||
| */ | ||||||||||
| import IntegrationsModal from '../../src/blocks/contact-form/components/jetpack-integrations-modal'; | ||||||||||
| import EmptyResponses from '../../src/dashboard/components/empty-responses'; | ||||||||||
| import EmptySpamButton from '../../src/dashboard/components/empty-spam-button'; | ||||||||||
| import EmptyTrashButton from '../../src/dashboard/components/empty-trash-button'; | ||||||||||
| import Flag from '../../src/dashboard/components/flag'; | ||||||||||
| import Gravatar from '../../src/dashboard/components/gravatar'; | ||||||||||
| import Page from '../../src/dashboard/components/page'; | ||||||||||
| import './style.scss'; | ||||||||||
| import * as Tabs from '../../src/dashboard/components/tabs'; | ||||||||||
| import useCreateForm from '../../src/dashboard/hooks/use-create-form'; | ||||||||||
| import { getPath } from '../../src/dashboard/inbox/utils'; | ||||||||||
| import WpRouteDashboardSearchParamsProvider from '../../src/dashboard/router/wp-route-dashboard-search-params-provider.tsx'; | ||||||||||
| import { store as dashboardStore } from '../../src/dashboard/store'; | ||||||||||
| import useConfigValue from '../../src/hooks/use-config-value'; | ||||||||||
| import { INTEGRATIONS_STORE, IntegrationsSelectors } from '../../src/store/integrations'; | ||||||||||
|
Comment on lines
35
to
41
|
||||||||||
|
|
@@ -185,7 +188,7 @@ function Stage() { | |||||||||
| [] | ||||||||||
| ); | ||||||||||
| const { updateCountsOptimistically, invalidateCounts } = useDispatch( | ||||||||||
| dashboardStore | ||||||||||
| ( dashboardStore as unknown as { name: string } ).name | ||||||||||
|
||||||||||
| ( dashboardStore as unknown as { name: string } ).name | |
| dashboardStore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious about this change as well. Can you elaborate, @dhasilva ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, that is a leftover from trying to fix types.
Outdated
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type assertion suggests a mismatch between the expected store type and what useDispatch returns. Consider defining a proper type for the store or accessing the store name property in a type-safe way.
| ( dashboardStore as unknown as { name: string } ).name | |
| ) as DispatchActions; | |
| dashboardStore | |
| ) as unknown as DispatchActions; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,11 +5,10 @@ import { useEntityRecords, store as coreDataStore } from '@wordpress/core-data'; | |||||
| import { useDispatch, useSelect } from '@wordpress/data'; | ||||||
| import { useMemo, useRef, useEffect, useState } from '@wordpress/element'; | ||||||
| import { decodeEntities } from '@wordpress/html-entities'; | ||||||
| import { isEmpty } from 'lodash'; | ||||||
| import { useSearchParams } from 'react-router'; | ||||||
| /** | ||||||
| * Internal dependencies | ||||||
| */ | ||||||
| import { useDashboardSearchParams } from '../router/dashboard-search-params-context.tsx'; | ||||||
| import { store as dashboardStore } from '../store/index.js'; | ||||||
| /** | ||||||
| * Types | ||||||
|
|
@@ -38,10 +37,15 @@ const formatFieldName = fieldName => { | |||||
| return fieldName; | ||||||
| }; | ||||||
|
|
||||||
| // https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore?tab=readme-ov-file#_isempty | ||||||
| const isEmpty = obj => | ||||||
|
||||||
| const isEmpty = obj => | |
| const isEmpty = ( obj: unknown ): boolean => |
simison marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching from lodash/isEmpty to the custom isEmpty helper while also changing the condition to if ( ! fieldValue || isEmpty( fieldValue ) ) alters the previous behavior: values like 0 or false that were previously rendered as "0" / "false" will now be treated as empty and displayed as '-'. If preserving the original semantics is desired, this should rely solely on the structural emptiness check (and/or explicitly handle only the cases that should map to '-'), so that falsy but meaningful values are not hidden from the UI.
Uh oh!
There was an error while loading. Please reload this page.