Skip to content

ECHOES-1454 Add emptyContent to FilterDropdownCategoryWithItems - #759

Draft
kimphanh wants to merge 1 commit into
mainfrom
kim/filter-empty-state/ECHOES-1454
Draft

ECHOES-1454 Add emptyContent to FilterDropdownCategoryWithItems#759
kimphanh wants to merge 1 commit into
mainfrom
kim/filter-empty-state/ECHOES-1454

Conversation

@kimphanh

@kimphanh kimphanh commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Part of


Summary by Gitar

  • Components:
    • Added emptyContent property to FilterDropdownCategoryWithItems for empty states
    • Created StyledEmptyContentWrapper and default message key filter.dropdown.emptyContent

This will update automatically on new commits.

@kimphanh kimphanh self-assigned this Aug 27, 2026
@netlify

netlify Bot commented Aug 27, 2026

Copy link
Copy Markdown

Deploy Preview for echoes-react ready!

Name Link
🔨 Latest commit f44d3d2
🔍 Latest deploy log https://app.netlify.com/projects/echoes-react/deploys/6a902cd79a5d320008316e13
😎 Deploy Preview https://deploy-preview-759--echoes-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Aug 27, 2026

Copy link
Copy Markdown

ECHOES-1454

Comment thread i18n/keys.json

const hasCustomContent = isCategoryWithContent(activeCategory);
const isLoadingItems = !hasCustomContent && !isDefined(items);
const isEmptyItems = !hasCustomContent && isDefined(items) && items.length === 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Edge Case: Empty state after a search is blank or shows a misleading message

isEmptyItems is derived from the raw items, not from filteredItems, so the two search modes now behave inconsistently: with client-side search (isSearchable without onSearch), typing a query that matches nothing renders an empty list with no message at all (asserted by the new test), whereas with server-side search (onSearch updating items to []) the panel shows the category's emptyContent — e.g. "No milestones have been created yet" — even though milestones exist and only the query matched nothing. Consider deriving the empty state from filteredItems and/or rendering a distinct "no results for <query>" message when searchQuery is non-empty.

Was this helpful? React with 👍 / 👎

@kimphanh
kimphanh force-pushed the kim/filter-empty-state/ECHOES-1454 branch from b3bd390 to f87f89e Compare August 27, 2026 12:09
@kimphanh
kimphanh force-pushed the kim/filter-empty-state/ECHOES-1454 branch from f87f89e to f44d3d2 Compare August 27, 2026 12:25
@gitar-bot

gitar-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 1 resolved / 2 findings

Adds emptyContent to FilterDropdownCategoryWithItems to support empty states, addressing the i18n key default message mismatch. Consider deriving the empty state from filteredItems so client-side and server-side search modes handle no-results states consistently.

💡 Edge Case: Empty state after a search is blank or shows a misleading message

📄 src/components/filters/FilterDropdownRightPanel.tsx:75 📄 src/components/filters/FilterDropdownRightPanel.tsx:79-84 📄 src/components/filters/FilterDropdownRightPanel.tsx:167-178 📄 src/components/filters/tests/FilterDropdown-test.tsx:264-278

isEmptyItems is derived from the raw items, not from filteredItems, so the two search modes now behave inconsistently: with client-side search (isSearchable without onSearch), typing a query that matches nothing renders an empty list with no message at all (asserted by the new test), whereas with server-side search (onSearch updating items to []) the panel shows the category's emptyContent — e.g. "No milestones have been created yet" — even though milestones exist and only the query matched nothing. Consider deriving the empty state from filteredItems and/or rendering a distinct "no results for <query>" message when searchQuery is non-empty.

✅ 1 resolved
Bug: i18n key default message disagrees with formatMessage default

📄 i18n/keys.json:34-37 📄 src/components/filters/FilterDropdownRightPanel.tsx:170-176 📄 src/components/filters/FilterDropdownTypes.ts:62-67
i18n/keys.json declares filter.dropdown.emptyContent with defaultMessage: "No filter option available", while the formatMessage call in FilterDropdownRightPanel uses defaultMessage: 'Empty content'. keys.json is generated by yarn build-intl-keys (formatjs extract) and yarn intl-keys-check (part of validate-ci) fails when the committed file differs from the extraction, so this PR breaks CI. Pick one wording: either the placeholder-looking 'Empty content' in the source is wrong and should become 'No filter option available' (also updating the @defaultValue TSDoc on emptyContent and the two test assertions on 'Empty content'), or regenerate keys.json.

🤖 Prompt for agents
Code Review: Adds `emptyContent` to `FilterDropdownCategoryWithItems` to support empty states, addressing the i18n key default message mismatch. Consider deriving the empty state from `filteredItems` so client-side and server-side search modes handle no-results states consistently.

1. 💡 Edge Case: Empty state after a search is blank or shows a misleading message
   Files: src/components/filters/FilterDropdownRightPanel.tsx:75, src/components/filters/FilterDropdownRightPanel.tsx:79-84, src/components/filters/FilterDropdownRightPanel.tsx:167-178, src/components/filters/__tests__/FilterDropdown-test.tsx:264-278

   `isEmptyItems` is derived from the raw `items`, not from `filteredItems`, so the two search modes now behave inconsistently: with client-side search (`isSearchable` without `onSearch`), typing a query that matches nothing renders an empty list with no message at all (asserted by the new test), whereas with server-side search (`onSearch` updating `items` to `[]`) the panel shows the category's `emptyContent` — e.g. "No milestones have been created yet" — even though milestones exist and only the query matched nothing. Consider deriving the empty state from `filteredItems` and/or rendering a distinct "no results for <query>" message when `searchQuery` is non-empty.

Implementation Status ✅ 1 of 1 objectives covered
ECHOES-1454 - 1 of 1 objectives covered

This PR adds the emptyContent property to FilterDropdownCategoryWithItems to display when items is an empty array.

✅ 1 covered here
  • ✅ Add emptyContent property to FilterDropdownCategoryWithItems to display when items is an empty array
Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant