[GH-ISSUE #80] ReferenceError 'wsPath is not defined' breaks navigation when loading at / (no workspace param) — PWAs broken on launch #37

Closed
opened 2026-10-18 14:02:16 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @chhotu-claw on GitHub (Jun 25, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/80

Summary

Loading the app at / with no ?workspace= query param throws an uncaught ReferenceError, which breaks the client-side routing effect — navigation stops working (e.g. clicking a chat in the sidebar does nothing). This hits installed PWAs on every launch, because the manifest's start_url is /. Regular browser tabs usually escape it because they reopen at a saved ?workspace=… URL.

Root cause

In src/routes/+page.svelte, the workspace-loading $effect has a final branch that references an undefined variable wsPath (it should be workspacePath):

$effect(() => {
    const workspacePath = $page.url.searchParams.get('workspace');
    ...
    } else if (workspacePath && workspacePath === lastLoadedPath) {
        ...
    } else if (!wsPath) {          // <-- ReferenceError: wsPath is not defined
        lastLoadedPath = null;
        currentWorkspace.set(null);
        processIntentParams();
    }
});

When workspacePath is falsy (URL / with no workspace), the first three else ifs are skipped and the engine evaluates !wsPath. wsPath is never declared anywhere in the file, so this throws ReferenceError, aborting the effect and leaving the app on the landing screen with broken navigation.

Why it especially hurts PWAs

manifest.json sets start_url: "/", so an installed PWA always cold-launches at / (no workspace param) → the effect throws on every launch. The app shows the landing page and clicking a chat does nothing. In a normal tab you typically land on /?workspace=… (restored), so the throwing branch is never reached — which is why it looks "browser works, PWA broken."

Fix

} else if (!workspacePath) {

One-character class of fix (wsPath → workspacePath). After this, cold-launching at / correctly clears workspace state and processes intents, and PWA navigation works.

Repro

  1. Open the app at the bare origin (https://<host>/, no ?workspace=), e.g. in a fresh/incognito window or an installed PWA.
  2. Click a chat in the sidebar → nothing happens; console shows ReferenceError: wsPath is not defined.
Originally created by @chhotu-claw on GitHub (Jun 25, 2026). Original GitHub issue: https://github.com/open-webui/computer/issues/80 ## Summary Loading the app at `/` with **no `?workspace=` query param** throws an uncaught `ReferenceError`, which breaks the client-side routing effect — navigation stops working (e.g. clicking a chat in the sidebar does nothing). This hits **installed PWAs on every launch**, because the manifest's `start_url` is `/`. Regular browser tabs usually escape it because they reopen at a saved `?workspace=…` URL. ## Root cause In `src/routes/+page.svelte`, the workspace-loading `$effect` has a final branch that references an **undefined variable `wsPath`** (it should be `workspacePath`): ```ts $effect(() => { const workspacePath = $page.url.searchParams.get('workspace'); ... } else if (workspacePath && workspacePath === lastLoadedPath) { ... } else if (!wsPath) { // <-- ReferenceError: wsPath is not defined lastLoadedPath = null; currentWorkspace.set(null); processIntentParams(); } }); ``` When `workspacePath` is falsy (URL `/` with no workspace), the first three `else if`s are skipped and the engine evaluates `!wsPath`. `wsPath` is never declared anywhere in the file, so this throws `ReferenceError`, aborting the effect and leaving the app on the landing screen with broken navigation. ## Why it especially hurts PWAs `manifest.json` sets `start_url: "/"`, so an installed PWA always cold-launches at `/` (no workspace param) → the effect throws on every launch. The app shows the landing page and clicking a chat does nothing. In a normal tab you typically land on `/?workspace=…` (restored), so the throwing branch is never reached — which is why it looks "browser works, PWA broken." ## Fix ```ts } else if (!workspacePath) { ``` One-character class of fix (`wsPath` → `workspacePath`). After this, cold-launching at `/` correctly clears workspace state and processes intents, and PWA navigation works. ## Repro 1. Open the app at the bare origin (`https://<host>/`, no `?workspace=`), e.g. in a fresh/incognito window or an installed PWA. 2. Click a chat in the sidebar → nothing happens; console shows `ReferenceError: wsPath is not defined`.
Author
Owner

@tjbck commented on GitHub (Jun 25, 2026):

Should be addressed!

<!-- gh-comment-id:4800977488 --> @tjbck commented on GitHub (Jun 25, 2026): Should be addressed!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/computer#37
No description provided.