Fix bug where helpview fails to load sub-pages after idle (#1056)

closes #1048
This commit is contained in:
Evan Simkowitz 2024-10-17 15:38:42 -07:00 committed by GitHub
parent a5999aa02a
commit f77b42d70c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,12 +50,16 @@ function makeHelpViewModel(blockId: string, nodeModel: NodeModel) {
function HelpView({ model }: { model: HelpViewModel }) {
const homepageUrl = useAtomValue(model.homepageUrl);
const url = useAtomValue(model.url);
// Effect to update the docsite base url when the app restarts, since the webserver port is dynamic
useEffect(
() =>
fireAndForget(async () => {
const curDocsiteUrl = getApi().getDocsiteUrl();
if (curDocsiteUrl !== homepageUrl) {
await model.setHomepageUrl(curDocsiteUrl, "block");
model.loadUrl(url.replace(homepageUrl, curDocsiteUrl), "new-base-url");
}
}),
[]