fix: make apps work in built copies of goose#6901
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug preventing standalone app windows from loading in production builds of the goose desktop application. The issue occurred because the old code extracted the URL origin from the launching window, which returns the string "null" for file:// URLs in production builds, resulting in invalid URLs like "null/#/standalone-app?...".
Changes:
- Replaced broken URL origin extraction with the same URL construction pattern used for main window and launcher window creation
- Improved query parameter encoding by using URLSearchParams instead of manual encodeURIComponent calls
- Added comment explaining the fix for future maintainers
ui/desktop/src/main.ts
Outdated
| await appWindow.loadURL(standaloneUrl); | ||
|
|
||
| // Construct URL the same way as main window - using dev server in dev mode, | ||
| // or file:// URL in production. This fixes app loading on Windows builds. |
There was a problem hiding this comment.
I'd delete the comment about "fixing", since this is how it should have always been really
ui/desktop/src/main.ts
Outdated
| await appWindow.loadURL(standaloneUrl); | ||
|
|
||
| // Construct URL the same way as main window - using dev server in dev mode, | ||
| // or file:// URL in production. This fixes app loading on Windows builds. |
There was a problem hiding this comment.
drop the comments? I don't know how this is related to Windows builds
ui/desktop/src/main.ts
Outdated
|
|
||
| // Construct URL the same way as main window - using dev server in dev mode, | ||
| // or file:// URL in production. This fixes app loading on Windows builds. | ||
| const url = MAIN_WINDOW_VITE_DEV_SERVER_URL |
There was a problem hiding this comment.
this is literalyy the same as for the main window indeed, can we not just reuse that?
b564d8b to
9fda4fa
Compare
…ntext * 'main' of github.com:block/goose: refactor(providers): extract ProviderDef trait and OpenAiCompatibleProvider (#6832) feat: ask ai discord bot (#6842) chore(maintenance): make GitHub repo configurable for auto-updater and publisher (#6828) fix: make apps work in built copies of goose (#6901) Remove dependency on goose-mcp from goose crate (#6637) Clean up build canonical warnings (#6880) Sync desktop_prompt with UI (#6898)
Signed-off-by: Harrison <hcstebbins@gmail.com>
The old code in the
launch-appIPC handler tried to construct the standalone app URL by extracting the origin from the current window's URL:just run-ui), the main window URL ishttp://localhost:5173/..., sooriginreturnshttp://localhost:5173file://URL likefile:///C:/path/to/app/index.html#/.... Forfile://URLs,new URL(...).originreturns the string"null"This caused the standalone app window to try loading a URL like
null/#/standalone-app?.... The fix constructs the URL the same way the main window URL is constructed elsewhere in the codebase:http://localhost:5173)pathToFileURL()to properly construct afile://URL pointing to the bundled HTML file