Repository navigation
fix: A preview whose app never started is hot-restarted, not shown blank - #2
Merged
Merged
Conversation
…ank. The pane waits 8 s for the app's main() and used to mark the preview live regardless, which dropped the overlay onto a white page, reported it as running and raised "Your project has started" over it. Seen after creating a project; pressing Hot Restart cured it. The first load (and the reload a project switch does) now falls back to the runner's hot restart, whose hard reload reveals the page. Once per load, and revealed as before when no restart is possible. Process changes that landed while the webview was initializing were also dropped until the runner next notified; the pane now catches up on them once init finishes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
Sometimes, after creating a project, the preview ends up on a white screen with the app never loaded. Pressing Hot Restart fixes it.
PreviewPanewaits 8 s for the app'smain()to run (_waitForFlutterMain). When that ran out it calledmarkPreviewLive()anyway, which:Nothing ever retried.
Fix
main()hasn't run in time, the first load calls the newServerpodProcessController.recoverStalledPreview()instead of revealing the page. So does the hard reload a project switch does. It is the runner's hot restart, the same as the button, and that restart's hard reload reveals the page. Full Restart is not used: it costs minutes._ensureWebViewnow catches up on them once init succeeds. It doesn't after a failed init, which would otherwise retry at once, forever.Root cause: not found
Ruled out by testing against a scratch Flutter web app:
main()call (the bootstrap fallback racing DWDS's RunRequest): the engine throws "Invalid engine initialization state" and the app renders normally.main()about 0.5 s later, with the fallback switched off.popUntilstops athome.A freshly created Serverpod template app reaches
main()about 2.3 s after navigation on an idle Mac.Testing
flutter analyzeis clean and the fullflutter testsuite passes.test/process/serverpod_process_test.dartcoverrecoverStalledPreview: it restarts and reloads, leaves a refused restart to the pane, does nothing once live, and does nothing before the server is running.🤖 Generated with Claude Code