Skip to content

fix(data-objectstack): read view overrides from the type='view' namespace they are written to (#3774) - #3777

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3774-view-overrides-readback
Aug 8, 2026
Merged

yinlianghui merged 1 commit into
mainfrom
claude/issue-3774-view-overrides-readback

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes #3774

结论:前提成立,两半件都在本 PR

写落在 type='view',读却把对象名塞进了 metadata TYPE 槽,两边键空间不相交;而读方法自吞异常返回 {},又让本来正确的逐视图回落变成不可达代码。用户调的密度/列宽/排序/隐藏列/inlineEdit 确实写进了 sys_metadata,但永远读不回来。

先测量,再定方向(不臆造服务端参数)

单里建议的 /meta/view?object= 服务端并不存在。实测两处:

  • packages/client/src/index.ts — meta.getItems(type, options?: { packageId }),URL 只拼 ?package=。
  • packages/rest/src/rest-server.ts 的 GET /meta/:type handler — 只读 req.query.package 与 req.query.preview,再无其它过滤位。

所以没有可下推的对象过滤。正确路线就是同文件 listViews() 已经在走的那条:枚举一次 type='view',在客户端收窄到本对象(它的注释也早写明「metadata index is name-only, not field-typed」)。这不是「拿全量假装过滤」——它就是本仓既有且唯一可行的拼法。

顺带把「这行 view 属于哪个对象」抽成 一个 共享 accessor viewItemObjectName(),listViews 与 listViewOverrides 同源。同一命名空间两个读者各留一份私有判断,迟早漂移成「切换器列得出的视图,表格找不到它的 override」。

override 文档的形状按 framework protocol-view-identity-overlay.test.ts(objectstack#2555)钉的事实取:个性化行的 object / name 由 overlay 补齐并保留在顶层,与 getView 读回的是同一份文档——测试里直接断言 batched 与 perView 相等,这个相等性才是「一次调用替代 N 次」的前提。

第二半件:吞错不再冒充权威

listViewOverrides 去掉外层 catch { return {} }。两个答案是两件事,不能折叠成同一个值:

  • 成功返回空 map = 权威的「本对象没有 override」→ 调用方可信任并跳过逐视图读取,批量优化原样保留(已钉)。
  • 失败 = 「我说不准」→ 抛出,让调用方的逐视图回落真正跑起来。

拒绝不会进缓存(MetadataCache 只在成功时 set),所以一次抖动不会把空答案钉住整个 TTL——这条也单独钉了。

DataSource.listViewOverrides 的接口文档同步写死这两条契约(原文档正是把错误命名空间当成范例写的),让后来的适配器不会再把失败实现成 {}。

消费半径:两个调用点,不只编辑的那个包

规则改在 data-objectstack,消费者在 app-shell,有两个:

  • ObjectView.loadBatch —— 它的 catch 本来就是对的,适配器停止吞错后自然可达,逻辑一字未改;只把三分支读取提取成导出的 loadViewOverrides() 以便直接钉(沿用本文件 defaultListColumnsFromObject 的既有先例)。
  • InterfaceListPage —— 这个必须改:它把批量调用放在外层 try 里,适配器改为抛出后,一次失败会连它自己的逐视图 getView 回落一起跳过。给批量调用加了独立 catch,失败落到逐视图读取。

反向验证(先预判方向,再跑)

回退 type 槽修复 → 预判适配器 round-trip 与 wire-route 转红。实测 6 红,报错直接指认旧路由:

AssertionError: expected [] to deeply equal [ 'crm_lead.all' ]
AssertionError: expected 'http://test.local/api/v1/meta/crm_lead' to match /\/meta\/view(\?|$)/

注意「空成功返回 {}」那条在此回退下依然绿 —— 错命名空间的枚举同样合法地返回空。这正是空成功测试单独抓不到本 bug、必须写 round-trip 的原因。

回退吞错修复 → 这里要如实报告:分诊卡预判的是「(c) 转红」,实测不成立,也不可能成立。(c) 在 app-shell,直接 stub 一个会抛的 dataSource,根本不经过适配器,回退适配器的 catch 动不了它。真正转红的是适配器侧那两条钉:

× a FAILING enumeration rejects — it must not masquerade as an empty map
× a rejection is not cached — the next call re-reads instead of pinning the failure
AssertionError: promise resolved "{}" instead of rejecting

而 app-shell 8 条全绿。这恰恰说明为什么两半件必须各自带钉:app-shell 那条钉的是「回落分支写对了」,只有适配器那条钉能保证这个分支在真实适配器上够得着。

测试

  • packages/data-objectstack/src/listViewOverrides.test.ts(9 条,新增)—— round-trip(用适配器自己的写路径灌一个 stub sys_metadata,再用它自己的读路径取;拿手写 fixture 断言会在整个 bug 期间保持绿,因为命名空间错误就住在 fixture 里)、type 槽 + 真实 HTTP 路由双重断言、对象收窄、空成功 vs 失败、拒绝不入缓存。
  • packages/app-shell/src/views/ObjectView.viewOverrides.test.tsx(8 条,新增)—— 批量优先且不再逐视图读、空成功提前返回、失败落到 getView、非对象结果落回、无 listViewOverrides 的适配器不受影响。

全量:data-objectstack + types 744 passed / 53 files;app-shell 2677 passed(1 skipped)/ 299 files;三包 type-check 与 lint 均 0 error。check-control-bytes 通过,并对改动文件做了越过该门的手工扫描。


Generated by Claude Code

…pace they are written to (#3774)

`listViewOverrides` enumerated `GET /api/v1/meta/{objectName}`, putting the
object name in the metadata TYPE slot, while `updateViewConfig` persists under
`type='view'`. The key spaces are disjoint, so the batch map was empty for every
object and every saved list-view personalization (density, column widths, sort,
hidden columns, inlineEdit) was written but never read back.

Measured before choosing the route: `GET /meta/:type` accepts `?package=` and
`?preview=draft` and nothing else, so there is no server-side `?object=` to push
the filter into. The read now enumerates `type='view'` once and narrows to the
object client-side — the same route `listViews()` already takes over the same
rows, now through one shared `viewItemObjectName` accessor so the two readers of
that namespace cannot drift.

Second half: the batch read no longer swallows failures into `{}`. An empty map
is an authoritative "no overrides exist" and still returns early (the batch
optimization is intact); a failure now rejects, so the per-view `getView`
fallback it had turned into unreachable code is reachable again.
`DataSource.listViewOverrides` documents both terms, and `InterfaceListPage`
scopes its batch call so a rejection reaches its own per-view fallback.

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Aug 8, 2026 2:37pm

Request Review

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Main entry (gzip) 28.1 KB 350 KB
Entry file index-BGuXK0yC.js —
Status PASS —

📦 Bundle Size Report

Package Size Gzipped
app-shell (index.js) 8.66KB 3.13KB
app-shell (runtime-config.js) 7.42KB 2.32KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 7.57KB 2.97KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 1.17KB 0.53KB
auth (AuthProvider.js) 22.10KB 4.37KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.13KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.64KB 2.21KB
auth (SocialSignInButtons.js) 9.60KB 3.89KB
auth (UserMenu.js) 3.40KB 1.22KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 35.76KB 9.11KB
auth (createAuthenticatedFetch.js) 4.37KB 1.69KB
auth (index.js) 2.35KB 1.07KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 4.91KB 0.87KB
auth (useIsWorkspaceAdmin.js) 1.61KB 0.85KB
collaboration (CommentThread.js) 26.07KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.65KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 482.22KB 106.21KB
core (index.js) 2.96KB 1.13KB
create-plugin (index.js) 9.85KB 3.18KB
data-objectstack (index.js) 139.51KB 35.97KB
fields (index.js) 230.90KB 56.84KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (i18n.js) 4.32KB 1.77KB
i18n (index.js) 2.65KB 1.06KB
i18n (pickLocalized.js) 1.70KB 0.83KB
i18n (provider.js) 9.48KB 3.27KB
i18n (useObjectLabel.js) 27.59KB 6.63KB
i18n (useSafeTranslation.js) 4.52KB 1.96KB
layout (index.js) 38.53KB 10.71KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.74KB
mobile (index.js) 1.50KB 0.62KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.71KB 0.42KB
mobile (useResponsiveConfig.js) 1.36KB 0.63KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 8.75KB 3.06KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 3.67KB 1.12KB
permissions (evaluator.js) 4.41KB 1.44KB
permissions (index.js) 0.91KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.52KB
permissions (usePermissions.js) 1.55KB 0.71KB
plugin-ai (index.js) 15.71KB 3.79KB
plugin-calendar (index.js) 44.98KB 12.37KB
plugin-charts (index.js) 61.04KB 17.31KB
plugin-chatbot (index.js) 180.09KB 42.72KB
plugin-dashboard (index.js) 117.06KB 30.24KB
plugin-designer (index.js) 210.51KB 42.51KB
plugin-detail (index.js) 232.81KB 57.42KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 112.10KB 27.10KB
plugin-gantt (index.js) 162.55KB 39.57KB
plugin-grid (index.js) 187.71KB 49.68KB
plugin-kanban (index.js) 48.30KB 13.28KB
plugin-list (index.js) 105.12KB 25.48KB
plugin-map (index.js) 16.81KB 5.24KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 40.58KB 10.58KB
plugin-timeline (index.js) 25.76KB 7.33KB
plugin-tree (index.js) 8.50KB 2.88KB
plugin-view (index.js) 84.03KB 20.55KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.71KB 3.53KB
providers (index.js) 0.44KB 0.22KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.67KB 2.37KB
react (LazyPluginLoader.js) 3.77KB 1.33KB
react (SchemaRenderer.js) 19.28KB 6.38KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 1.02KB 0.55KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 4.09KB 1.74KB
sdui-parser (index.js) 4.47KB 2.03KB
sdui-parser (parse.js) 10.04KB 2.82KB
sdui-parser (types.js) 0.29KB 0.24KB
sdui-parser (validate.js) 4.69KB 1.48KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.87KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-retry.js) 4.32KB 2.02KB
types (index.js) 2.71KB 1.34KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (spec-report.js) 5.05KB 1.93KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 0.20KB 0.18KB
types (ui-action.js) 3.40KB 1.71KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@yinlianghui
yinlianghui marked this pull request as ready for review August 8, 2026 15:03
@yinlianghui
yinlianghui added this pull request to the merge queue Aug 8, 2026
Merged via the queue into main with commit 7e2b7e9 Aug 8, 2026
20 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3774-view-overrides-readback branch August 8, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants