fix(notebooks): fix race condition in view registration (#13106) #13115
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.
What it does
Fixes #13106
Fixes a race condition that occurred when event handlers for
onDidRegisterNotebookSerializer
were registered after said event was fired. This prevented the correct rendering of a notebook the first time one was opened during the lifetime of a page.To solve this, we're storing the events that are fired before any event handler is registered and replay them for the first such handler only.Review comments highlighted this was not necessary and that there was a simpler solutionHow to test
Install the necessary vscode plugins:
ms-python.python
(https://open-vsx.org/extension/ms-python/python)ms-toolsai.jupyter
(https://open-vsx.org/extension/ms-toolsai/jupyter)Create a new file with extension
.ipynb
Open the file from the explorer
Observe the notebook UI is shown immediately, as opposed to an empty editor before the patch.
Follow-ups
Review checklist
Reminder for reviewers