Skip to content

[Routine - VT] fix(provider): guard against stale groupIdx when rendering file bookmarks#78

Draft
winterdrive wants to merge 1 commit into
mainfrom
routine/vt-fix-bookmark-stale-groupidx-260703
Draft

[Routine - VT] fix(provider): guard against stale groupIdx when rendering file bookmarks#78
winterdrive wants to merge 1 commit into
mainfrom
routine/vt-fix-bookmark-stale-groupidx-260703

Conversation

@winterdrive

Copy link
Copy Markdown
Owner

1. Pre-flight Check

Open PRs / active branches checked before starting:

This PR only touches src/provider.ts, which none of the above modify — no overlap.

2. Changes

TreeDataProvider.getChildren() had a branch for TempFileItem that looked up const group = this.groups[element.groupIdx] and passed it directly into BookmarkManager.getBookmarksForFile(group, ...), which unconditionally dereferences group.bookmarks. If element.groupIdx is stale (e.g. a group was removed via removeGroupById or reordered via moveGroup, shifting array indices) before this tree node re-renders, group is undefined and the call throws. The sibling TempFolderItem branch just above already has an if (!group) return []; guard for this exact stale-index scenario — this PR adds the equivalent guard for the TempFileItem branch.

Confirmed this PR does not modify commands, contributed configuration keys, dependencies, or the tab-group serialization/storage format.

3. Safety Verification

Commands run locally, all passed:

  • npx tsc -p ./ — no errors
  • npm run test (tsc -p ./ && jest --runInBand) — 25 suites / 175 tests passed

4. CI / Release Gate Note

This is a daily routine Draft PR. Package version bump and CHANGELOG updates are intentionally deferred to the weekend release/integration PR. If CI fails only due to the repository's version-bump/release-readiness gate, that is expected behavior for a routine PR, not a code validation failure.

…arks

getChildren() for a TempFileItem looked up its group via a cached
groupIdx and passed it straight to BookmarkManager.getBookmarksForFile,
which dereferences group.bookmarks unconditionally. If the groups array
had shifted (group removed/reordered) before the tree node re-rendered,
this threw instead of returning an empty list, mirroring the existing
stale-index guard already present for TempFolderItem just above it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant