From 817afd6138a9120f9957765c232eb99ac7eebcdb Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 1 Aug 2024 00:35:44 -0700 Subject: [PATCH] update web view url if meta url changes --- frontend/app/view/webview.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/app/view/webview.tsx b/frontend/app/view/webview.tsx index 9f5a4a14b..4d672dfc3 100644 --- a/frontend/app/view/webview.tsx +++ b/frontend/app/view/webview.tsx @@ -301,6 +301,15 @@ interface WebViewProps { const WebView = memo(({ parentRef, model }: WebViewProps) => { const url = model.getUrl(); + const blockData = jotai.useAtomValue(model.blockAtom); + const metaUrl = blockData?.meta?.url; + const metaUrlRef = React.useRef(metaUrl); + useEffect(() => { + if (metaUrlRef.current != metaUrl) { + metaUrlRef.current = metaUrl; + model.navigateTo(metaUrl); + } + }, [metaUrl]); useEffect(() => { const webview = model.webviewRef.current;