Skip to content

Build your personal knowledge base with Trilium Notes

fix(webview): refresh content for SPAs with "query string" in hash

contributorac24c6985857
diff --git a/apps/client/src/types-lib.d.ts b/apps/client/src/types-lib.d.ts
index 4f942b8cb6..8d3c9296d1 100644
--- a/apps/client/src/types-lib.d.ts
+++ b/apps/client/src/types-lib.d.ts
@@ -66,6 +66,7 @@ declare module "preact" {
interface ElectronWebViewElement extends JSX.HTMLAttributes<HTMLElement> {
src: string;
class: string;
+ key?: string | number;
}
interface IntrinsicElements {
diff --git a/apps/client/src/widgets/type_widgets/WebView.tsx b/apps/client/src/widgets/type_widgets/WebView.tsx
index bbf170933d..4d45295e87 100644
--- a/apps/client/src/widgets/type_widgets/WebView.tsx
+++ b/apps/client/src/widgets/type_widgets/WebView.tsx
@@ -57,6 +57,7 @@ function DesktopWebView({ src, ntxId }: { src: string, ntxId: string | null | un
return <webview
ref={webviewRef}
src={src}
+ key={src}
class="note-detail-web-view-content"
/>;
}
@@ -80,6 +81,7 @@ function BrowserWebView({ src, ntxId }: { src: string, ntxId: string | null | un
return <iframe
ref={iframeRef}
src={src}
+ key={src}
class="note-detail-web-view-content"
sandbox="allow-same-origin allow-scripts allow-popups" />;
}