Repository navigation
feat(webview): durable per-view viewStates pipeline (N2, split 2/3 of #1546) #2227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e67ab35
f28c486
7906df6
f560872
6340998
1357d5b
c59f82f
afa9ab3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
| command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } | ||
| git lfs post-checkout "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
| command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } | ||
| git lfs post-commit "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
| command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } | ||
| git lfs post-merge "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
| command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } | ||
| git lfs pre-push "$@" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,9 @@ | |
| taskHistory: true, | ||
| listApiConfigMeta: true, | ||
| currentApiConfigName: true, | ||
| // Per-view selection state is machine-local: it keeps flowing through the | ||
| // normal runtime and pruning paths but must not transfer between settings. | ||
| viewStates: true, | ||
|
Check warning on line 41 in src/core/config/ContextProxy.ts
|
||
| }) | ||
|
|
||
| export class ContextProxy { | ||
|
|
@@ -360,13 +363,23 @@ | |
| return value !== undefined ? value : defaultValue | ||
| } | ||
|
|
||
| updateGlobalState<K extends GlobalStateKey>(key: K, value: GlobalState[K]) { | ||
| async updateGlobalState<K extends GlobalStateKey>(key: K, value: GlobalState[K]) { | ||
| if (isPassThroughStateKey(key)) { | ||
| return this.originalContext.globalState.update(key, value) | ||
| } | ||
|
|
||
| const previousCachedValue = this.stateCache[key] | ||
| this.stateCache[key] = value | ||
| return this.originalContext.globalState.update(key, value) | ||
|
|
||
| try { | ||
| return await this.originalContext.globalState.update(key, value) | ||
| } catch (error) { | ||
| // A rejected write must not leave the cache ahead of storage: callers that then | ||
| // read the cached value (e.g. the view-state load path) would act on a selection | ||
| // that was never persisted. | ||
| this.stateCache[key] = previousCachedValue | ||
|
Comment on lines
+374
to
+380
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| throw error | ||
| } | ||
| } | ||
|
|
||
| private getAllGlobalState(): GlobalState { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
cat .husky/_/pre-push cat .husky/_/h cat .husky/pre-push git ls-files .husky grep -n -E '"prepare"|"husky"' package.jsonRepository: Zoo-Code-Org/Zoo-Code
Length of output: 2608
Web query:
husky 9.1.7 install source code .husky/_ directory stub files h gitignore hooksPath generated on prepareResult:
Restore the Husky hook chain by untracking
.husky/_and calling Git LFS from.husky/pre-push.Under
core.hooksPath=.husky/_, Git runs.husky/_/pre-push. The committed file runs onlygit lfs pre-pushand never reaches.husky/pre-push. Pushes then skip themainbranch guard,check-types, and the test run whenRUN_TESTS_ON_PUSHistrue. Husky runs the project hook withsh -e, so a failingcheck-typesor test command also rejects the push.huskyruns duringprepareand rewrites every.husky/_hook, includingpre-push, as a stub that calls.husky/pre-push. The committed stub therefore stays active only until the nextpnpm install. Switching to a branch without these files deletes the tracked stubs, and Git then runs no pre-push hook untilpnpm installruns again.Untrack the generated directory:
Move the Git LFS call into the project hook, as the first command so it reads the pushed refs from stdin before other commands run:
🐛 Suggested fix