fix(metadata-protocol): inherit view identity onto runtime overlays#2558
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
A console personalization PUT (grid sort, inline edit) sends only the raw view config with no top-level viewKind/object. saveMetaItem persisted it verbatim, and getMetaItems replaced the flattened package entry with the overlay row wholesale — stripping the identity fields the view-switcher endpoint filters on (viewKind && object). One sort click made the view vanish from the switcher until the sys_metadata row was deleted. - write path: saveMetaItem passes the shadowed registry entry into normalizeViewMetadata, which inherits missing viewKind/object/label onto non-container bodies (overlay's own fields always win). - read path: getMetaItems heals identity-less rows already persisted by pre-fix saves the same way, so polluted DBs recover on read. - tests: 4 new e2e cases (stubbed engine) + 4 pure-function cases. Closes #2555 Co-Authored-By: Claude <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.
Closes #2555
问题(3777 实测复现)
用户在 console 网格上点一次列排序,该视图从视图切换器永久消失:
sort:[…]),没有顶层viewKind/object;normalizeViewMetadata只补name,saveMetaItem原样落sys_metadata。getMetaItems把 overlay 行按 name 整条替换注册表的展平条目 —— 展平条目上的viewKind: 'list'、object就此丢失。rest-server.ts)过滤v.viewKind && v.object === obj,缺身份字段的行被滤掉。GET /meta/view?object=showcase_task从 17 项掉到 15 项。修复(双保险)
saveMetaItem把 registry 中将被遮蔽的同名条目作为baseline传入normalizeViewMetadata,非容器 body 缺viewKind/object/label时继承后再持久化。overlay 自己的字段永远优先;defineView容器 body 不动(身份在展平时派生);registry 无getItem的部分 mock 下降级为原行为。getMetaItems合并循环里,type=view 的 DB 行缺身份字段时从被遮蔽条目继承 —— 已被 pre-fix 保存污染的库(如 3777 环境的 2 行)读取即恢复,无需手工清库。两处共用同一个
viewIdentityPatchhelper。测试
@objectstack/metadata-protocol8 pass;@objectstack/objectql745 pass(60 files)。Co-Authored-By: Claude noreply@anthropic.com