Postpone initialization to after UI has sent Ready event#2903
Merged
DocMoebiuz merged 3 commits intomainfrom Apr 15, 2026
Merged
Postpone initialization to after UI has sent Ready event#2903DocMoebiuz merged 3 commits intomainfrom
DocMoebiuz merged 3 commits intomainfrom
Conversation
|
Build for this pull request: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a frontend→backend “ready” handshake so the backend postpones publishing startup/progress messages until the /start UI route is ready to receive them, addressing the reported stuck splash/start loop (fixes #2864).
Changes:
- Add a new
CommandFrontendStatecommand type and send it from the/startUI when mounted. - Subscribe to
CommandFrontendStateinMainFormand move main initialization work to run after the frontend signalsready. - Register the new incoming command type in the backend project.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/MobiFlightConnector/frontend/src/types/commands.d.ts |
Adds CommandFrontendState to the frontend command type system. |
src/MobiFlightConnector/frontend/src/components/StartupProgress.tsx |
Publishes CommandFrontendState (ready) from the /start route. |
src/MobiFlightConnector/UI/MainForm.cs |
Defers backend initialization until the frontend sends ready. |
src/MobiFlightConnector/MobiFlightConnector.csproj |
Includes the new backend incoming command class in compilation. |
src/MobiFlightConnector/MobiFlight/BrowserMessages/Incoming/CommandFrontendState.cs |
Defines backend payload type for the new frontend state command. |
|
Build for this pull request: |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/MobiFlightConnector/UI/MainForm.cs:510
OnFrontendReadyis triggered by an incoming WebView message and isasync voidwithout any exception handling. If anything throws during initialization, it can crash the UI thread andfrontendReadywill staytrue, preventing any retry. Wrap the body intry/catchwithLog.Instance.log(..., LogSeverity.Error)and consider only settingfrontendReady(or aninitializedflag) after successful initialization (or resetting it on failure).
private async void OnFrontendReady(object sender, EventArgs e)
{
if (Properties.Settings.Default.Started == 0)
{
OnFirstStart();
}
|
Build for this pull request: |
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.
We now wait for the UI to signal that the progress bar is ready. Only then we will continue with the rest of the initialization.
Background:
fixes #2864