Fix #142: Prevent Design Switcher from briefly showing 'Offline'#2421
Merged
dipenpradhan merged 1 commit intomainfrom Apr 15, 2026
Merged
Fix #142: Prevent Design Switcher from briefly showing 'Offline'#2421dipenpradhan merged 1 commit intomainfrom
dipenpradhan merged 1 commit intomainfrom
Conversation
When enableLiveUpdates() was called, it launched a coroutine to collect the Figma token from the settings flow. The flow's initial emission was null (before the stored value was read), which momentarily set isDocumentLive to false, causing the Design Switcher to flash 'Offline' before settling on 'Live'. Fix: Set isDocumentLive to true optimistically at the start of enableLiveUpdates(). The collectLatest coroutine will correct it to false if no token is ultimately found.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2421 +/- ##
============================================
- Coverage 44.05% 44.03% -0.03%
Complexity 19 19
============================================
Files 39 39
Lines 4444 4444
Branches 51 51
============================================
- Hits 1958 1957 -1
- Misses 2472 2473 +1
Partials 14 14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Snapshot diff report vs base branch: main |
dipenpradhan
approved these changes
Apr 10, 2026
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
Fixes the Design Switcher briefly flashing "Offline" status when switching documents.
Problem
When
enableLiveUpdates()is called, it sets up a coroutine to collect the Figma token from a DataStore-backed flow. The flow's initial emission isnull(before the stored value is read from disk), which momentarily setsisDocumentLivetofalse. The Design Switcher reads this value and briefly shows the "Offline" variant.Timeline
Fix
Set
isDocumentLive = trueoptimistically at the start ofenableLiveUpdates():Behavior
Changes
designcompose/src/main/java/com/android/designcompose/DocServer.kt: SetisDocumentLive.value = truebefore launching the token collection coroutineValidation
./gradlew designcompose:compileDebugKotlin: Passes ✅Fixes #142