Repository navigation
fix(state): avoid ambiguous Map keys during edits - #1169
Open
shuaiyafei wants to merge 1 commit into
Open
shuaiyafei wants to merge 1 commit into
shuaiyafei wants to merge 1 commit into
Conversation
✅ Deploy Preview for vue-devtools-docs canceled.
|
commit: |
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.
Summary
Use the same preview-label rules for creating Map keys that state-path resolution already uses.
For example, a Map can contain the numeric key
1. Renaming a different entry to the string"1"previously passedMap.has("1"), wrote the new value, and created a second key with the same displayed label. Subsequent state-path resolution rejects that label as ambiguous, so neither entry can be edited or deleted through the inspector.The fix checks existing preview labels before writing, preserving the original values and reactive effects when a rename is rejected. The rename helper applies the same guard.
Automatic key generation also checks preview labels: an existing
Symbol("newProp1")reserves that display name, so a new entry gets the next available name. Its label set is built once per addition.Coverage
The collision cases failed before the corresponding fixes.
Validation
pnpm lintpnpm test: 415 tests passed across 67 filespnpm typecheckpnpm build