Skip to content

Postpone initialization to after UI has sent Ready event#2903

Merged
DocMoebiuz merged 3 commits intomainfrom
2864/stuck-on-boot
Apr 15, 2026
Merged

Postpone initialization to after UI has sent Ready event#2903
DocMoebiuz merged 3 commits intomainfrom
2864/stuck-on-boot

Conversation

@DocMoebiuz
Copy link
Copy Markdown
Collaborator

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:

  • Users reported that sometimes the splash screen would not advance.
  • Assumption: the initialization is faster than loading the frontend, and the frontend misses messages from the backend.
  • This fix makes sure that the UI is ready to receive messages from the backend.

fixes #2864

Copilot AI review requested due to automatic review settings April 14, 2026 15:33
@github-actions
Copy link
Copy Markdown

Build for this pull request:
MobiFlightConnector.zip

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CommandFrontendState command type and send it from the /start UI when mounted.
  • Subscribe to CommandFrontendState in MainForm and move main initialization work to run after the frontend signals ready.
  • 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.

Comment thread src/MobiFlightConnector/frontend/src/components/StartupProgress.tsx
Comment thread src/MobiFlightConnector/frontend/src/components/StartupProgress.tsx
Comment thread src/MobiFlightConnector/UI/MainForm.cs
Comment thread src/MobiFlightConnector/UI/MainForm.cs
@github-actions
Copy link
Copy Markdown

Build for this pull request:
MobiFlightConnector.zip

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • OnFrontendReady is triggered by an incoming WebView message and is async void without any exception handling. If anything throws during initialization, it can crash the UI thread and frontendReady will stay true, preventing any retry. Wrap the body in try/catch with Log.Instance.log(..., LogSeverity.Error) and consider only setting frontendReady (or an initialized flag) after successful initialization (or resetting it on failure).
        private async void OnFrontendReady(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.Started == 0)
            {
                OnFirstStart();
            }

Comment thread src/MobiFlightConnector/frontend/tests/StartupProgress.spec.ts
@github-actions
Copy link
Copy Markdown

Build for this pull request:
MobiFlightConnector.zip

@DocMoebiuz DocMoebiuz merged commit ad34c39 into main Apr 15, 2026
2 checks passed
@DocMoebiuz DocMoebiuz added the bug Something isn't working in a officially released version label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working in a officially released version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stuck in start mode first application launch after computer reboot

2 participants