Repository navigation
Conversation
sharedState.get returns the empty initial value before the server reply. Applying that reply after start() built a pile cleared it, and the next save persisted the empty pile.
sharedState.get resolves after start() has already built the pile. The test emits the empty server value in that window, which used to clear the pile and persist it.
0froq
force-pushed
the
fix/card-pile-empty-echo
branch
from
November 17, 2026 05:42
a051ad4 to
89f0fcb
Compare
Author
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "89f0fcb20ac4e201c43f5f47468f7f89a0d93231",
"result": {
"overallSummary": "Fixes #90: `sharedState.get` returns the empty initial value before the server replies, and that late echo could overwrite a card pile that `start()` had just built locally — which then got persisted as an empty pile. The fix subscribes to `updated` before the first read, skips applying the value when that read times out, and ignores an empty server value while a local pile exists. `snapshot()` now hands immer plain objects instead of Vue reactive proxies.",
"groups": [
{
"key": "card-pile-echo",
"label": "Card pile echo handling",
"category": "core",
"filePaths": [
"ui/composables/useCardsMode.ts"
],
"fileNotes": [
{
"path": "ui/composables/useCardsMode.ts",
"text": "The new guard in `applyServerState` drops any empty incoming state while a local pile exists. That is what keeps a late echo from wiping a fresh pile, but it also means a legitimate remote clear (another client calling `dismiss()`) will no longer propagate to this client. `dismiss()` works only because it empties the local state before writing `null`."
},
{
"path": "ui/composables/useCardsMode.ts",
"text": "`waitForFirstUpdate` now resolves a boolean so the initial value is only read back when the server actually answered; the timeout path must not apply anything or it reintroduces the wipe. `snapshot()` deep-copies `pile`/`processedOps` and unwraps `source`/`options` with `toRaw` because immer freezes the draft and Vue proxies refuse reads on a frozen object."
}
]
},
{
"key": "tests",
"label": "Regression test and test config",
"category": "tests",
"filePaths": [
"ui/composables/useCardsMode.test.ts",
"vitest.config.ts"
],
"fileNotes": [
{
"path": "vitest.config.ts",
"text": "The `vue` alias points at the copy pnpm installed for the UI package (the root has no `vue` dependency), so it depends on the `.pnpm/node_modules` layout staying stable."
}
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-17T05:43:53.718Z",
"model": "openai-compatible/opencode-go/deepseek-v4.1-flash",
"locale": "en"
}
} |
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.
🔗 Linked issue
resolves #90
🧭 Context
sharedState.getreturns the empty initial value before the server answers.start()has already built a pile by then. Applying that empty echo clears it, and the next save stores the empty pile. Advancing after that can show an empty detail for a card that still has an issue number.📚 Description
Subscribe to
updatedbefore the first read, and do not apply the initial value when that read times out. If a pile already exists locally, ignore an empty server value so a late echo cannot wipe it.dismiss()still clears the pile, because it empties the local state before writingnull.snapshot()now passes plain objects intomutate.sourceandoptionsareVue reactive proxies, and immer throws when it reads them back off a frozen draft.
ui/composables/useCardsMode.test.tsstarts a pile of two issues, then emits the empty server value only aftersharedState.getresolves. Before this change the assertion receives[]. With it, both the local pile and the saved pile stay[2, 1].This is the first test that loads
ui/code from the root Vitest run, andvueis only installed for the UI package.vitest.config.tsaliases it to that copy. Drop the alias and the test if you would rather not run UI code from here ❤️