fix: keep sync store available during route changes#101
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new exported helper function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the createCurrentSyncChild utility function to handle child lookups within the sync context, replacing a previous createMemo implementation. Additionally, a new test suite has been added to verify that the child lookup remains functional even after the provider's owner is disposed. I have no feedback to provide.
Summary
Fix a renderer crash when switching session routes across workspaces by resolving the current sync child store from the consuming owner instead of caching it in the Sync provider owner. Add a regression test for the owner lifecycle invariant.
Why
Fixes #94. The crash stack pointed to
sync.data -> current()[0]after a route change. The previouscreateMemo(() => globalSync.child(sdk.directory))resolved and pinned the child store under the provider owner, so stale consumer computations could still read through a disposed provider during cross-directory session navigation.Related Issue
Fixes #94
How To Verify
Ran before dependency cleanup in this worktree:
Also ran a real Electron client-route E2E against the patched renderer: started from the
/Users/yuhan/PawWorksession, routed to/Users/yuhan/workspace/dev/pawworksessionsses_25248bc9cffePSNl6PXk12tw86andses_2544c191effeu1Nw5UECHonKbl, and confirmed noSomething went wrongpage orCannot read properties of undefinedcrash.Screenshots or Recordings
Not applicable. No visible UI change.
Checklist
devbranchSummary by CodeRabbit
Tests
Refactor