Skip to content

Commit

Permalink
fix: set shouldReloadPage instead of forcing true on one function
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <[email protected]>
  • Loading branch information
ryanabx committed Aug 26, 2024
1 parent f9d5dda commit f1acd63
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "ryanabx, contributors",
"repository": "https://github.com/ryanabx/djot-vscode",
"bugs": "https://github.com/ryanabx/djot-vscode/issues/new",
"version": "0.2.1",
"version": "0.2.2",
"engines": {
"vscode": "^1.92.0"
},
Expand Down
7 changes: 4 additions & 3 deletions src/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ class DjotPreview extends Disposable implements WebviewResourceProvider {
return;
}

const shouldReloadPage = forceUpdate || !this._currentVersion || this._currentVersion.resource.toString() !== pendingVersion.resource.toString() || !this._webviewPanel.visible;
const shouldReloadPage = true; // TODO: Fix this condition shouldReloadPage
// const shouldReloadPage = forceUpdate || !this._currentVersion || this._currentVersion.resource.toString() !== pendingVersion.resource.toString() || !this._webviewPanel.visible;
this._currentVersion = pendingVersion;

let selectedLine: number | undefined = undefined;
Expand All @@ -267,15 +268,15 @@ class DjotPreview extends Disposable implements WebviewResourceProvider {
}
}


const content = await (shouldReloadPage
? this._contentProvider.renderDocument(document, this, this._previewConfigurations, this._line, selectedLine, this.state, this._imageInfo, this._disposeCts.token)
: this._contentProvider.renderBody(document, this));

// Another call to `doUpdate` may have happened.
// Make sure we are still updating for the correct document
if (this._currentVersion?.equals(pendingVersion)) {
// this._updateWebviewContent(content.html, shouldReloadPage);
this._updateWebviewContent(content.html, true); // TODO: Fix this condition shouldReloadPage
this._updateWebviewContent(content.html, shouldReloadPage);
}
}

Expand Down

0 comments on commit f1acd63

Please sign in to comment.