update web view url if meta url changes

This commit is contained in:
sawka 2024-08-01 00:35:44 -07:00
parent a23b5ca0e0
commit 817afd6138

View File

@ -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;