Repository navigation
feat(plugin-list): an empty list offers "Clear filters" when the reader's own filter emptied it - #29047
Merged
Conversation
…filter emptied it Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jS5v57GVJJL1k8m1nN
Contributor
Author
|
domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu 席位核对 · ACCEPT · 2026-11-02T06:42ZHead-sha:
|
This was referenced Nov 2, 2026
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #28908
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
list.clearFilters(十个语言包)。onFilterChange,宿主存下的是空条件组。用户筛选标签(chips)不在本次范围内,各自就地清除。回滚即回退本 PR。ui/packages/plugin-list/src/ListView.tsx(handleClearReaderQuery与传给ListEmptyState的onClearFilters判定);ui/packages/plugin-list/src/ListEmptyState.tsx(主次按钮与「只出现一个清除按钮」);新测试ListView.emptyStateClearFilters-28908.test.tsx。pnpm --dir ui exec vitest run packages/plugin-list/src/__tests__/ListView.emptyStateClearFilters-28908.test.tsx,预期 7 个用例全部通过;第一个用例断言主按钮是「Clear filters」、点击后空状态消失、角标不再显示 active。What changes
The empty state's clear action covers the reader's filters.
ListViewhandsListEmptyStatea newonClearFilterscallback whenever a filter the reader applied is part of the empty query: the filter panel's finished conditions (the same predicatehasUserQueryalready reads) or the "In a queue" toggle. The callback,handleClearReaderQuery, removes the reader's whole query:conditions: [], id and logic kept) through the same emit as a panel edit, so the toolbar badge clears and a host that stores the group throughonFilterChangestores the empty group;handleSearchChange('')when it holds anything, soonSearchChange('')reaches the host as it does for "Clear search".The view's declared
filteris never touched: it is not the reader's query, andbuildEffectiveFilterstill ANDs it into the next fetch.One clear action, leading.
ListEmptyStategains theonClearFiltersprop. Supplied, it draws "Clear filters" (data-testid="empty-state-clear-filters", the default button variant) and the add-record action steps down to the outline variant; it replaces "Clear search" rather than sitting beside it, since it clears the search too. Not supplied, the actions are exactly as before: a search alone draws the outline "Clear search" beside the primary "Add record".ListEmptyStateis module-internal (not exported from the package barrel), so the prop widens no public surface.Copy. One new string,
list.clearFilters, in all ten built-in locale packs and in plugin-list'sLIST_DEFAULT_TRANSLATIONS(en "Clear filters", zh 清除筛选). Each translation matches the wording the same locale already uses for the Gantt quick-filter's clear action.Tests
ui/packages/plugin-list/src/__tests__/ListView.emptyStateClearFilters-28908.test.tsx(new), 7 cases, mounted on a data source that answers zero rows for the reader's miss and one lead otherwise:onFilterChange, the next fetch carries no miss, the empty state is gone and the filter trigger's label no longer reads active;onSearchChange('');Acceptance notes
UserFiltersholds its own selection and each chip clears in place; resetting chips from the empty state would need a key remount, which ui/AGENTS.md Convert to monorepo with scoped packages #8 forbids. So a list emptied by a chip alone keeps the "your current filters or search" copy and offers only "Add record". When the panel or the queue toggle is also set, "Clear filters" clears those and the search, and the chip stays.Clause-②: yes (widening)for the one new key on@object-ui/i18n's locale catalogue, as the claim amendment rules;Metadata-protocol: none(no metadata key or option).Verification
Readings on
f44092be(the change) unless named;ceaa4f90mergesorigin/main(2ac698batouched the locale packs with other keys, clean merge), and the scoped re-check after it is named below.Tests
pnpm --dir ui exec vitest run packages/plugin-list/ packages/i18n/(under the verify lock,--maxWorkers=2): 274 files passed; 3172 tests passed, 13 skipped.pnpm --dir ui exec vitest run scripts/: 169 files passed, 2 skipped; 4900 tests passed.scripts/ablation-replace.mjsreplaced? handleClearReaderQueryin theonClearFiltershandoff with an undefined callback. The new file went 4 failed / 3 passed (the four "Clear filters" cases red; search-only, declared-only and chip-only green, as they pin unchanged behaviour). The restore leg read blob == HEAD and an emptygit diff HEAD.ceaa4f90):packages/i18n/plus the 15 plugin-list test files that name the empty state (git grep -lofempty-state,ListEmptyState,clearSearch) and the new file: 109 files passed; 1694 tests passed, 13 skipped. The merge rebuilt the plugin-list closure first (49/49 tasks).Type-check, lint
turbo run type-check --filter=@object-ui/plugin-list --filter=@object-ui/i18n: 51/51 tasks onf44092be; 51/51 tasks again onceaa4f90.as anydata-source casts in the new test, the pattern the neighbouring empty-state tests use, and pre-existing ones).node scripts/check-sdui-manifest.mjs: exit 0 (no component config changed).pnpm check:new-line-citationsunderui/: 0 new citations.Derived gates
node scripts/pm/dispatch-gates.mjs --ran: 34 derived families accounted for, 34 run, 0 NOT MEASURED, every one exit 0. The PR-body gates (check-changeset-no-major,check-closing-keyword-parity,check-partof-closing-keyword,check-adr-0087-registration,check-empty-changeset) ran on this body: exit 0 on each.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jS5v57GVJJL1k8m1nN
Generated by Claude Code