Only rebuild walkthrough markdown media on unload (#176831)

Only rebuild walkthrough on unload
This commit is contained in:
Bhavya U 2023-03-13 08:01:43 -07:00 committed by GitHub
parent a0ab3587b5
commit 917b32cf9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -658,8 +658,8 @@ export class GettingStartedPage extends EditorPane {
const layoutDelayer = new Delayer(50);
this.layoutMarkdown = () => {
layoutDelayer.trigger(async () => {
this.buildMediaComponent(stepId);
layoutDelayer.trigger(() => {
webview.postMessage({ layoutMeNow: true });
});
};
@ -674,7 +674,10 @@ export class GettingStartedPage extends EditorPane {
this.openerService.open(message, { allowCommands: true });
} else if (message.startsWith('setTheme:')) {
this.configurationService.updateValue(ThemeSettings.COLOR_THEME, message.slice('setTheme:'.length), ConfigurationTarget.USER);
} else {
} else if (message === 'unloaded') {
this.buildMediaComponent(stepId);
}
else {
console.error('Unexpected message', message);
}
}));

View file

@ -125,6 +125,11 @@ export class GettingStartedDetailsRenderer {
</body>
<script nonce="${nonce}">
const vscode = acquireVsCodeApi();
window.addEventListener('unload', event => {
vscode.postMessage('unloaded');
});
document.querySelectorAll('[when-checked]').forEach(el => {
el.addEventListener('click', () => {
vscode.postMessage(el.getAttribute('when-checked'));