fix(appearance): avoid first theme switch timeout - #2665
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 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.
Summary
Fix the first theme switch becoming disabled for approximately 20 seconds due to a circular wait between the Web UI appearance transaction and the Desktop ProductControl runtime-effect callback.
The Web UI now acknowledges a pending theme selection only when the corresponding theme has actually been applied to
AppearanceRuntime. External theme changes continue through the existing persisted-state reconciliation path.Adds regression coverage for:
Fixes #
Type and Areas
Type:
Regression fix
Areas:
Web UI, Desktop/Tauri ProductControl integration
Motivation / Impact
The first theme change after startup entered the
applyingstate and disabled the theme selectors while waiting for configuration persistence. Desktop ProductControl then requested confirmation from the Web UI, but the Web UI queued reconciliation behind the transaction that was already waiting for that confirmation.This circular wait ended only after the 20-second ProductControl timeout. It could also roll back the first theme selection and mark the presentation surface as unavailable.
After this change, the first theme switch completes normally without waiting for the timeout. External or Agent-initiated theme changes retain their existing reconciliation behavior.
Verification
pnpm --dir src/web-ui run test:run src/app/global-search/bitfunControlBridge.test.ts src/infrastructure/appearance/runtime/AppearanceService.test.tspnpm run check:webgit diff --checkManual Peer Device and remote workspace scenarios were not exercised.
Reviewer Notes
The fix does not remove the normal
applying-state UI lock or shorten the backend timeout. It prevents the self-originated ProductControl callback from re-entering the serialized appearance mutation queue.The acknowledgement requires all of the following:
AppearanceRuntimeconfirms that the resolved theme is already active.No user-facing strings, persisted data shapes, migrations, or backend contracts were changed.
Checklist