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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

notebook: reload backLayerWebView when kernels change #122965

Merged

Conversation

connor4312
Copy link
Member

@connor4312 connor4312 commented May 4, 2021

This reloads the webview when a kernel with a preload changes. There
were two larger reworks in here:

  • The existing reload handler didn't work, since it didn't wait for
    the initialization message and would send render requests before the
    listener was ready.

    Instead, always run the reload "restore" when initialization happens.
    This means we also don't need to wait for the "loaded" promise, which
    is a good thing since that would have been a false indicator around
    reloads.

  • Cache more data around markdown cells so they can be restored after
    reload. Namely, their complete content rather than just a hash.
    I assume this was avoided for memory usage -- if it's a concern, one
    alternative would be to keep a reference to the ICellViewModel so
    that getText can be called on-demand. Let me know your thoughts.

    I would appreciate 馃憖 in general here since I am less
    familiar with the markdown code.

Fixes #120747

This reloads the webview when a kernel with a preload changes. There
were two larger reworks in here:

- The existing reload handler didn't work, since it didn't wait for
  the initialization message and would send render requests before the
  listener was ready.

  Instead, always run the reload "restore" when initialization happens.
  This means we also don't need to wait for the "loaded" promise, which
  is a good thing since that would have been a false indicator around
  reloads.

- Cache more data around markdown cells so they can be restored after
  reload. Namely, their complete content rather than just a hash.
  I assume this was avoided for memory usage -- if it's a concern, one
  alternative would be to keep a reference to the ICellViewModel so
  that `getText` can be called on-demand. Let me know your thoughts.

Fixes #120747
@connor4312 connor4312 requested review from rebornix and mjbvz May 4, 2021 22:48
@connor4312 connor4312 self-assigned this May 4, 2021
this.markdownPreviewMapping.clear();
for (const cell of mdCells) {
if (cell.visible) {
this.createMarkdownPreview(cell);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use initializeMarkdownPreview instead? This will create the cells one a time, which is more likely to cause flickering

@connor4312 connor4312 merged commit dc00301 into notebook/dev May 6, 2021
@connor4312 connor4312 deleted the connor4312/reload-notebook-on-kernel-change branch May 6, 2021 00:18
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants