Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better implementation of initial scan and render #396

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

Charlie-XIAO
Copy link
Contributor

@Charlie-XIAO Charlie-XIAO commented Feb 3, 2025

Extracted from #370.

Previously the manager simply waits for a few seconds before the initial scan and render, because we are unsure whether the canvas is ready to listen to the render event. The case can be summarized as this:

  • If the canvas listener is ready first, then everything is okay.
  • If the event is emitted before the canvas listener is ready, then the event will be missed.

This PR implements a mechamism that can be summarized as follows:

  • The backend keeps a state that records (1) whether the canvas listener is ready and (2) a potentially pending message payload.
  • When the canvas listener is ready, mark it in that state, and if there is a pending message payload there immediately emit to the canvas.
  • For the manager, instead of just emitting, it calls a backend command that checks whether the canvas listener is ready first. If it is ready, immediately emit, otherwise it puts the payload in that state.

Some other changes:

  • Previously the render event is per widget. Now it is for an array of widgets.

@Charlie-XIAO Charlie-XIAO merged commit 1195dca into main Feb 3, 2025
11 checks passed
@Charlie-XIAO Charlie-XIAO deleted the feat/smart-initial-scan branch February 3, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant