fix(web): container ENV vars unreliably applied due to startup race#972
Merged
PartyDonut merged 1 commit intoDonutWare:developfrom Apr 28, 2026
Merged
Conversation
9 tasks
PartyDonut
approved these changes
Apr 28, 2026
Collaborator
PartyDonut
left a comment
There was a problem hiding this comment.
Nice catch, and thanks for fixing it!
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.
Pull Request Description
Container ENV vars (
BASE_URL,SEERR_BASE_URL, etc.) stopped being applied reliably on my Container/WebUI deployment. After some researching, I found PR #805 which seems to introduce a regression:The behaviour I see is inconsistent: sometimes the login screen reflects the ENV vars (Jellyfin URL/Seerr URL ENV vars set -> both URL field hidden from UI, etc.), sometimes it doesn't - the Jellyfin URL field reappears Seerr URL field is configurable, and so on. A page refresh makes it fail much more often, but it can also go wrong on the very first load.
Possible Regression
Before #805,
config.jsonwas loaded inmain()before the app started. So by the time any screen rendered, the config was guaranteed ready.After #805, the load was moved into a post-frame callback on the web wrapper. That callback is async, but Flutter's post-frame queue doesn't wait for async work to finish. So
LoginScreen's own post-frame callback runs in the same tick and reads the still-empty config singleton.It's a timing race: whoever finishes first wins. The ~500ms
SplashScreendelay usually hides it on cold loads (the network fetch has time to resolve), but on a refresh everything is served from the cache in milliseconds and the race is lost almost every time. On first loads it can still go wrong whenever the config fetch happens to be slow enough.Fix
Restore the pre-#805 behaviour: Load
config.jsoninsidebootstrapApplication, awaited beforerunApp. By the time any widget'sinitStateruns,FladderConfigis guaranteed populated.Issue Being Fixed
Regression from #805.
How To Reproduce (before this fix)
BASE_URL=https://jellyfin.DOMAIN.TLDAfter applyint this PR, the UI state is consistent across cold loads and refreshes.
Screenshots
N/A
Notes
AI Disclosure
Diagnosed and fixed with assistance help from Claude Code (Opus 4.7). The LLM helped me trace the init sequence.
I've reviewed and tested the fix end-to-end.
Tested On
Checklist