Skip to content

Commit

Permalink
Add comment explaining why we use just the root of a ref in claiming …
Browse files Browse the repository at this point in the history
…and releasing the webview
  • Loading branch information
nstrayer committed Dec 20, 2024
1 parent bdec72a commit 2cbdd9e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ export function useWebviewMount(webview: Promise<INotebookOutputWebview>) {
return;
}
try {
// We're using the base ref here because it's a constant reference and thus
// will avoid unnecessary mismatches for claiming and releasing the webview
// across multiple renders.
webviewElement.claim(containerRef, getWindow(containerRef.current), undefined);
} catch (err) {
setError(new WebviewMountError('Failed to claim webview', err instanceof Error ? err : undefined));
Expand Down

0 comments on commit 2cbdd9e

Please sign in to comment.