feat(showcase): 演示作用于选中记录的批量 action - #4201
Merged
Merged
Conversation
`bulkActions` — naming declared object actions so each SELECTED record is fanned out through the action runner — had no example in the showcase. It is also the only way to declare a bulk action: `action.bulkEnabled` was retired in spec 17 (#3896 close-out, #4054) precisely because nothing consumed it, and its tombstone prescribes this key. Adds a `bulk_actions` named view on showcase_task — the selection-bar twin of the existing `legacy_row_actions` fixture — naming both an action whose work is a sandboxed script (showcase_mark_done, via the platform action route) and one that is a custom endpoint (showcase_recalc_estimate, whose already-declared `recordIdParam` carries each record's id). Neither is a field patch, which is what distinguishes this from project.view.ts's `bulkActionDefs`: those mass-EDIT through the data API, this dispatches a real action per record. Verified in a browser against this app: selecting all 10 tasks and running each button issues 10 POSTs (one per record, all 200) to /api/v1/actions/showcase_task/showcase_mark_done and /api/v1/showcase/recalc respectively, and the records change server-side. No console errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
…changeset The zh-CN bundle must carry every declared label — the i18n coverage ratchet counts untranslated declared strings per example and refused the 456 → 457 growth. And objectstack requires a changeset per PR; an empty one is the sanctioned declaration for a change that releases nothing (the showcase package is private). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
showcase 里一直没有
bulkActions的例子 —— 而它恰恰是声明批量 action 的唯一方式:action.bulkEnabled在 spec 17 的 #3896 收尾里被退役(#4054),正因为从来没有消费方,它的墓碑给的处方就是这个 key。改动
在
showcase_task上加一个bulk_actions命名视图 —— 既有legacy_row_actionsfixture 的选择栏孪生。两个名字都是对象上已声明的 action,故意各取一种形态:showcase_mark_donescriptdone/progressshowcase_recalc_estimateapi/api/v1/showcase/recalc,靠已声明的recordIdParam带上每条记录的 id两者都不是字段 patch —— 这正是它和
project.view.ts里bulkActionDefs的分工:那边是经数据 API 批量改字段(operation: 'update'+ patch),这边是把选中记录逐条派发给 action runner,于是「不是字段赋值」的 action(脚本、自定义端点)也能作用于一批记录。顺带在 UI 导览里写清这两种 bulk 词汇的分工,并点明
bulkEnabled不是第三条路。验证
在本 app 的真实后端 + console 里点完整流程:
POST /api/v1/actions/showcase_task/showcase_mark_done,全 200;10 条记录 已完成 = ✓、进度 = 100。POST /api/v1/showcase/recalc,全 200(recordIdParam确实带上了 id,没有 400);预计工时逐条重算并刷新。pnpm validate/pnpm typecheck/pnpm test(10 文件 60 测试)全绿。纯示例 + 文档,不动任何运行时代码。
🤖 Generated with Claude Code