feat(app-shell,plugin-list): 列表过滤条件跨页面切换后按用户保留 (#2294)#2295
Open
baozhoutao wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
…igation (#2294) List search term and advanced FilterBuilder conditions were component-local ListView state, destroyed on unmount when navigating away via a sidebar link and lost on return (uf_* URL params only survive reload/back, not in-app nav). Cache the runtime filter (advanced filter + search) in localStorage keyed by user + object + view, and restore it into ListView at mount: - add listFilterStorage.ts (build/read/write helpers, 300ms debounced write, key removed when state empty) - key embeds userId so two accounts on one browser never read each other's filter values - ObjectView writes on onFilterChange/onSearchChange, restores via new ListView initialFilters/initialSearchTerm props (one-shot lazy init; ListView remounts by key on view switch so it re-reads per view) - server-side shared view definition (persistViewPatch) untouched; this is a purely per-user, device-local layer
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.
Closes #2294
问题
对象列表(数据模式
ObjectView)中输入搜索词 / 设置高级筛选后,经侧边栏切到其他页面再切回,过滤条件全部丢失。根因:searchTerm/currentFilters是ListView的本地 state,导航离开时随卸载销毁;uf_*URL 参数只在刷新 / 后退时保留,应用内导航离开再回来同样会丢。方案
按 用户 × 对象 × 视图 把运行时过滤状态缓存到
localStorage,ListView挂载时恢复。packages/app-shell/src/views/listFilterStorage.ts——buildListFilterKey/readListFilterState/writeListFilterState,300ms 防抖写入,状态为空时删除键,private-mode / 配额异常静默兜底。list-filters:<userId>:<对象>:<视图ID>,内嵌 userId,同一浏览器切换账号互不读取对方过滤值(过滤值可能敏感;列宽grid-columns-*为纯外观、故意不做用户隔离)。ObjectView在onFilterChange/onSearchChange写入,挂载时经新增的initialFilters/initialSearchTerm恢复。ListView用key在视图切换时重挂载,懒初始化按视图正确重读。persistViewPatch);本永续层纯用户个人、端末本地。ObjectView;InterfaceListPage后续视需要跟进。验证(framework showcase 实测)
生产管理 →「排班计划」列表,均以 SPA 导航(侧边栏离开→返回)验证:
焊接焊接,列表已过滤 ✓00 生产localStorage 实际写入(userId 已内嵌):