Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ui/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,12 @@ export function AppInner() {
view: viewFromUrl,
};
window.history.replaceState(
{},
initialViewOptions,
'',
`/recipe-editor?${new URLSearchParams(initialViewOptions).toString()}`
`#/recipe-editor?${new URLSearchParams(initialViewOptions).toString()}`
);
} else {
window.history.replaceState({}, '', `/${viewFromUrl}`);
window.history.replaceState({}, '', `#/${viewFromUrl}`);
}
}
window.electron.on('set-view', handleSetView);
Expand Down
18 changes: 13 additions & 5 deletions ui/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,11 +760,19 @@ const createChat = async (
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
mainWindow.loadURL(`${MAIN_WINDOW_VITE_DEV_SERVER_URL}/#/${queryParams}`);
} else {
// In production, we need to use a proper file protocol URL with correct base path
const indexPath = path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html/#/`);
mainWindow.loadFile(indexPath, {
search: queryParams ? queryParams.slice(1) : undefined,
});
// In production, load the HTML file first, then set the hash route
const indexPath = path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`);

// Load the file without hash
await mainWindow.loadFile(indexPath);

// After the file loads, set the hash route programmatically
if (queryParams) {
const hashRoute = queryParams.startsWith('?') ? `#/${queryParams}` : `#/?${queryParams}`;
await mainWindow.webContents.executeJavaScript(`
window.history.replaceState({}, '', '${hashRoute}');
`);
}
}

// Set up local keyboard shortcuts that only work when the window is focused
Expand Down