diff --git a/frontend/app/view/helpview/helpview.tsx b/frontend/app/view/helpview/helpview.tsx index 8dae6e0b6..1f3543fe8 100644 --- a/frontend/app/view/helpview/helpview.tsx +++ b/frontend/app/view/helpview/helpview.tsx @@ -54,6 +54,7 @@ class HelpViewModel extends WebViewModel { const strippedDocsiteUrl = getApi().getDocsiteUrl().replace(baseUrlRegex, ""); const strippedCurUrl = url.replace(baseUrlRegex, "").replace(strippedDocsiteUrl, ""); const newUrl = docsiteWebUrl + strippedCurUrl; + console.log("modify-external-url", url, newUrl); return newUrl; }; } @@ -97,7 +98,6 @@ function HelpView({ model }: { model: HelpViewModel }) { // Correct the base URL of the current page, if necessary const newBaseUrl = baseUrlRegex.exec(newDocsiteUrl)?.[0]; const curBaseUrl = baseUrlRegex.exec(url)?.[0]; - console.log("fix-docsite-url", url, newDocsiteUrl, homepageUrl, curBaseUrl, newBaseUrl); if (curBaseUrl && newBaseUrl && curBaseUrl !== newBaseUrl) { model.loadUrl(url.replace(curBaseUrl, newBaseUrl), "fix-fail-load"); } diff --git a/frontend/app/view/webview/webview.tsx b/frontend/app/view/webview/webview.tsx index ccaf12d24..3cbcbe858 100644 --- a/frontend/app/view/webview/webview.tsx +++ b/frontend/app/view/webview/webview.tsx @@ -142,6 +142,7 @@ export class WebViewModel implements ViewModel { icon: "arrow-up-right-from-square", title: "Open in External Browser", click: () => { + console.log("open external", url); if (url != null && url != "") { const externalUrl = this.modifyExternalUrl?.(url) ?? url; return getApi().openExternal(externalUrl); @@ -339,14 +340,14 @@ export class WebViewModel implements ViewModel { const searchTemplate = globalStore.get(defaultSearchAtom); const nextUrl = this.ensureUrlScheme(newUrl, searchTemplate); console.log("webview loadUrl", reason, nextUrl, "cur=", this.webviewRef?.current.getURL()); - if (newUrl != nextUrl) { - globalStore.set(this.url, nextUrl); - } if (!this.webviewRef.current) { return; } if (this.webviewRef.current.getURL() != nextUrl) { - this.webviewRef.current.loadURL(nextUrl); + fireAndForget(() => this.webviewRef.current.loadURL(nextUrl)); + } + if (newUrl != nextUrl) { + globalStore.set(this.url, nextUrl); } } @@ -531,8 +532,8 @@ const WebView = memo(({ model, onFailLoad }: WebViewProps) => { return; } const navigateListener = (e: any) => { + setErrorText(""); if (e.isMainFrame) { - setErrorText(""); model.handleNavigate(e.url); } }; @@ -582,6 +583,7 @@ const WebView = memo(({ model, onFailLoad }: WebViewProps) => { model.setMediaPlaying(false); }; + webview.addEventListener("did-frame-navigate", navigateListener); webview.addEventListener("did-navigate-in-page", navigateListener); webview.addEventListener("did-navigate", navigateListener); webview.addEventListener("did-start-loading", startLoadingHandler); @@ -596,6 +598,7 @@ const WebView = memo(({ model, onFailLoad }: WebViewProps) => { // Clean up event listeners on component unmount return () => { + webview.removeEventListener("did-frame-navigate", navigateListener); webview.removeEventListener("did-navigate", navigateListener); webview.removeEventListener("did-navigate-in-page", navigateListener); webview.removeEventListener("new-window", newWindowHandler); diff --git a/pkg/service/objectservice/objectservice.go b/pkg/service/objectservice/objectservice.go index 487372c89..0e265ef9a 100644 --- a/pkg/service/objectservice/objectservice.go +++ b/pkg/service/objectservice/objectservice.go @@ -145,7 +145,7 @@ func (svc *ObjectService) UpdateObjectMeta(uiContext waveobj.UIContext, orefStr } err = wstore.UpdateObjectMeta(ctx, *oref, meta, false) if err != nil { - return nil, fmt.Errorf("error updateing %q meta: %w", orefStr, err) + return nil, fmt.Errorf("error updating %q meta: %w", orefStr, err) } return waveobj.ContextGetUpdatesRtn(ctx), nil }