Uh oh!
There was an error while loading. Please reload this page.
refactor(ui-react): stabilize app shell effect callbacks - #512
Merged
Conversation
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 freeto 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.
Summary
useEffectEvent.activeId, while long-lived callbacks invoke the latest handlers.Why
Refs #477
AppShell subscription effects intentionally avoid resubscribing on every render, but they previously closed over many callback props. React 19's
useEffectEventis the smaller boundary for subscription, timer, and listener callbacks: subscription lifetime stays stable, callback bodies stay fresh, and ordinary UI callbacks stay outside the effect-event boundary.Scope
Changed:
useAppShellBootstrapSubscriptions()now wraps subscription, timer, keydown, and cleanup callbacks withuseEffectEventwhile preserving the mount-once effect boundary.useActiveSessionEvents()still resubscribes byactiveId, and its async read / session-event callbacks now use effect events for latest setters and handlers.Not included:
ChatViewor AppShell component-size split.Verification
npm run -w @maka/desktop build:main && (cd apps/desktop && node --test dist/main/__tests__/app-shell-effect-stability-contract.test.js dist/main/__tests__/session-message-lifecycle-contract.test.js dist/main/__tests__/permission-response-ipc-boundary.test.js dist/main/__tests__/renderer-startup-fail-soft-contract.test.js)(26 passed)npm run -w @maka/desktop build:renderer(passes; existing Vite large chunk warning remains)npm run -w @maka/desktop test(1863 passed)User-facing impact
None expected. This is an AppShell effect-boundary refactor; UI layout, copy, and interaction timing should stay the same.
Reviewer notes
The PR topic commits are rollback-sized:
refactor(ui-react): stabilize app shell effect callbackstest(ui-react): lock app shell effect stability contractsrefactor(ui-react): use effect events for app shell subscriptionsrefactor(ui-react): keep plan toast actions outside effect eventsA final merge commit syncs
origin/mainso the PR is mergeable after the Windows titlebar change landed.