Repository navigation
fix(kit): only treat ancestors as circular references - #1179
Merged
webfansplz merged 1 commit intoOct 26, 2026
Merged
Conversation
✅ Deploy Preview for vue-devtools-docs canceled.
|
commit: |
webfansplz
approved these changes
Oct 26, 2026
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.
encodeValueadds every visited object toseenand never removes it, so an object that appears a second time in the same value is encoded as{ kind: 'circular' }even when there is no cycle. With the default budget, a component returningrange: ref({ start: today, end: today })androws: ref(Array(2).fill(row))showsendandrows[1]as[Circular value:N]. Expanding the row loads the real value, but copied text and agent output only show the marker.This removes an object from
seenonce its subtree is done, so only ancestors on the current path count as circular. To keep the work bounded by the number of distinct objects as before, a repeated non-ancestor is encoded without children, like a value at the depth limit: it keeps its kind, size and handle, and the client loads its fields on expand. Dates, RegExps and Errors are still encoded in full. With the default budget (lazy children at depth 1, which the Vite plugin and Chrome extension use), repeated values now encode the same as non-shared ones.vitest run tests/unit/codec/encode-value.test.ts. On main the new test fails withexpected { kind: 'circular', handle: 'value:2' } to deeply equal { Object (kind, name, ...) }; with the change 15/15 pass.vitest run: 70 files, 431 tests pass (main: 70 files, 429 tests).vp fmt --checkandvp lint(type-aware) on both changed files, andtsc --noEmit -p packages/kit/tsconfig.json: no issues.components:stateSnapshotfor the component above returnsrange: start:date, end:dateandrows: 0:object, 1:object(main:end:circular,1:circular).{ l: next, r: next }encoded withmaxDepth: 21stays at about 4 KB (main: 3 KB), so shared subtrees are not walked once per path.