-
Notifications
You must be signed in to change notification settings - Fork 37.7k
notebooks: ensure preloads load before webview output is shown #101166
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
Conversation
This serializes code in the webview so that we make sure preloads load before rending output. Since the rendering of HTML can be deferred, we also potentially need to defer other actions like clearing and focusing.
| type: 'clear'; | ||
| } | ||
|
|
||
| export interface IFocusOutputMessage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this was duplicated, likely a copy-paste error)
| } | ||
|
|
||
| createInset(cell: CodeCellViewModel, output: IProcessedOutput, cellTop: number, offset: number, shadowContent: string, preloads: Set<string>) { | ||
| async createInset(cell: CodeCellViewModel, output: IProcessedOutput, cellTop: number, offset: number, shadowContent: string, preloads: Set<string>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think making this async is safe, since the display of content was already asynchronous behind the postMessage being sent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's safe. Can we also make the call hierarchy explicit async then others won't use it incorrectly later on?
rebornix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tested with setTimeout and it works fine.
This serializes code in the webview so that we make sure preloads load
before rending output. Since the rendering of HTML can be deferred,
we also potentially need to defer other actions like clearing and
focusing.
This PR fixes #101151
/cc @JacksonKearl