Skip to content

fix(grid): a legacy string row action runs instead of green-toasting a no-op (#2960) - #2996

Merged
os-zhuang merged 1 commit into
mainfrom
claude/legacy-string-rowactions-dead-end-631f21
Jul 30, 2026
Merged

fix(grid): a legacy string row action runs instead of green-toasting a no-op (#2960)#2996
os-zhuang merged 1 commit into
mainfrom
claude/legacy-string-rowactions-dead-end-631f21

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Fixes#2960.

症状

列表视图声明 rowActions: ['convert_lead'] 时,行菜单里的这一项点下去零网络请求却报成功。如果同一个 action 还声明了 locations: ['list_item'],菜单里会并排出现一个能用、一个是死的同名项。

根因

名字从来没变成 action。ObjectGrid 把 legacy 形式派发成 { type: <action 名>, params: { record } } —— action 的名字落进了 runner 的 type 槽位,从未拿去和对象的 action def 做解析。它匹配不到任何内建类型,也匹配不到 handler(除非恰好有人用这个名字注册过),于是落到 ActionRunner.executeActionSchema:对一个什么都没声明的 schema,它返回 {success: true, reload: true, close: true},接着 handlePostExecution 弹出绿色的 "Action completed successfully"。

改动

两处,任意一处都能让这个 bug 暴露出来:

ObjectGrid 把 legacy 名字解析到 objectDef.actions(新增纯函数 resolveLegacyRowActions):

  • 命中已声明的 action → 提升为该 def,走和 list_item action 完全相同的派发路径。于是它真的会执行,并且拿到 def 的 label、visible/disabled 谓词、参数弹窗和 capability gate —— 这些字符串形式一个都带不了。
  • 命中一个已经作为 def 渲染的 action → 丢弃,死的那个副本就此消失。
  • 解析不到 → 仍按名字派发,因为消费方可能正好用这个名字注册了 runner handler。

ObjectGrid 是三个调用方(app-shell ObjectView、plugin-view ObjectView、plugin-list ListView)的唯一收敛点,改一处即可覆盖。没有提升发生时该函数按引用返回原数组,RowActionMenuuseMemo 不会被打散。

ActionRunner 的空 schema 兜底改为响亮失败:不再为一个从未执行过的 action 报成功——没有注册 handler、也没有 api/endpoint/navigate/redirect/onClick 的派发,返回一条点名该 action 的失败。仅声明 schema 但确实有内容的形态(裸 redirect、显式 reload/close)行为完全不变,已注册 handler 的路径也未触碰。

未处理(有意)

同一文件里的批量 action 路径是同样的 {type: <name>} 形状,但 bulkActionDefs 从来不是由 objectDef.actions 推导出来的,没有可解析的对象;给它加推导是新功能而不是修这个 bug。改动 ② 让这条路径至少诚实地失败,而不是弹绿 toast。

验证

  • 反向对照:只 stash 掉两个源文件后,4 条新增的行为断言全部失败 —— success: true(应为 false)、绿色 toast 触发、fetch 调用 0 次、菜单里出现 2 项(应为 1 项)。
  • 受影响包packages/core/src/actions/ + packages/plugin-grid/src/ → 50 文件 / 506 测试全通过。
  • 全量套件:干净 stash 树上同样有 8 文件 / 22 测试失败(typesdata-objectstacki18nplugin-kanbanplugin-markdownplugin-listmetadata-admin@objectstack/spec dist 陈旧问题)。加不加本改动,失败文件集合完全一致,且都不在 core/actionsplugin-grid

新增测试:resolveLegacyRowActions.test.ts(7 条纯函数)、legacyRowActionDispatch.test.tsx(4 条,驱动真实 grid + runner)、ActionRunner.test.ts(4 条)。

🤖 Generated with Claude Code

…a no-op (#2960)
A list view declaring `rowActions: ['convert_lead']` rendered a menu item that
performed zero network requests and reported success. Where the object also
declared the same action with `locations: ['list_item']`, the row menu showed a
working entry and a dead duplicate of it side by side.
The name never became an action: ObjectGrid dispatched the legacy form as
`{ type: <action name>, params: { record } }` — the action NAME landing in the
runner's `type` slot, never resolved against the object's action defs. It
matches no built-in type and (absent a handler registered under that exact
name) no handler either, so it fell through to
`ActionRunner.executeActionSchema`, which returned
`{success: true, reload: true, close: true}` for a schema with nothing in it.
`handlePostExecution` then fired the green "Action completed successfully"
toast.
Two changes, either of which would have surfaced the bug:
1. ObjectGrid resolves legacy names against `objectDef.actions`
(`resolveLegacyRowActions`). A name matching a declared action is promoted to
that def and dispatched through the same path as a `list_item` action — so it
actually runs, and picks up the def's label, visible/disabled predicates,
param dialog and capability gate, none of which the string form could carry.
A name matching an action already rendered as a def is dropped, which removes
the dead twin. Names that resolve to nothing are still dispatched by name,
since a consumer may have registered a runner handler under exactly that
name. ObjectGrid is the chokepoint for all three callers (app-shell
ObjectView, plugin-view ObjectView, plugin-list ListView).
2. ActionRunner's empty-schema fallthrough fails loudly. It no longer reports
success for an action it never ran: a dispatch with no registered handler and
no api/endpoint/navigate/redirect/onClick returns a failure naming the
action. Schema-only shapes that do declare something — a bare `redirect`, an
explicit `reload`/`close` — run exactly as before.
The sibling bulk-action path carries the same `{type: <name>}` shape, but
`bulkActionDefs` is never derived from `objectDef.actions`, so there is nothing
to resolve against; change 2 makes it fail honestly rather than green-toast.
Verified: stashing only the two source files makes all four new behavioral
assertions fail — success:true where it should be false, the green toast
firing, fetch called 0 times, and 2 menu entries where there should be 1.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercelBot commented Jul 30, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredJul 30, 2026 8:20am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)27.9 KB350 KB
Entry fileindex-D8enztMI.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.20KB2.97KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.12KB3.41KB
auth (LoginForm.js)17.86KB5.29KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.43KB2.09KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.25KB1.01KB
auth (org-roles.js)6.72KB2.85KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)18.38KB4.49KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)3.65KB1.42KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.25KB0.53KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)454.03KB99.05KB
core (index.js)2.16KB0.78KB
create-plugin (index.js)9.28KB2.98KB
data-objectstack (index.js)134.67KB34.24KB
fields (index.js)221.10KB54.18KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.46KB0.96KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)5.37KB1.72KB
i18n (useObjectLabel.js)25.17KB5.80KB
i18n (useSafeTranslation.js)3.26KB1.44KB
layout (index.js)38.45KB10.67KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)4.42KB1.27KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)1.77KB0.77KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)6.84KB2.42KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)44.90KB12.35KB
plugin-charts (index.js)57.26KB16.24KB
plugin-chatbot (index.js)180.09KB42.72KB
plugin-dashboard (index.js)110.24KB28.47KB
plugin-designer (index.js)210.56KB42.56KB
plugin-detail (index.js)216.52KB53.02KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)103.30KB25.07KB
plugin-gantt (index.js)162.26KB39.53KB
plugin-grid (index.js)180.26KB47.25KB
plugin-kanban (index.js)47.82KB13.18KB
plugin-list (index.js)98.89KB23.41KB
plugin-map (index.js)16.80KB5.24KB
plugin-markdown (index.js)13.65KB4.67KB
plugin-report (index.js)40.24KB10.51KB
plugin-timeline (index.js)25.03KB7.11KB
plugin-tree (index.js)8.36KB2.81KB
plugin-view (index.js)85.88KB20.99KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.55KB0.67KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)19.28KB6.38KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.02KB0.55KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)3.47KB1.54KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)0.77KB0.41KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (index.js)1.94KB0.95KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)0.20KB0.18KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.04KB1.93KB
types (system-fields.js)2.39KB1.17KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)0.82KB0.48KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

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

@os-zhuang
os-zhuang merged commit 6f29aa5 into mainJul 30, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the claude/legacy-string-rowactions-dead-end-631f21 branch July 30, 2026 08:26
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant

@os-zhuang