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.
So this implements a queue allowing certain messages to be stored until the app is loaded. This works pretty well for foreground/background, but for tables is not very stable. Tables need the app to be fully ready. They seem to need an additional bit of time after the app is mounted in order to stably load and be interacted with. Adding 0.1 sec before loading tables seems to fix this.
This adds a
onMounted()
callback to the vue app, and amounted
traitlet which is synced to the front-end (.tag(sync=True)
). This is more reliable than attempting to pass a message from the the front-end to the backend. There are two ways to add functions to run when mounted.on_ready(callback)
andensure_mounted(callback)
.on_ready
adds what is passed to a list of callbacks which get run in order when mounted.ensure_mounted
either runs the callback immediately if the app is mounted, or it will add it to theon_ready
stack. The app will run stored messasges, then the callbacks when mounted.