Speed up recipe loading from deeplinks and various fixes (#3662)

This commit is contained in:
Zane
2025-07-28 14:17:43 -07:00
committed by GitHub
parent c7425694f8
commit 85c77474df
9 changed files with 321 additions and 61 deletions
+39
View File
@@ -1063,6 +1063,45 @@ export default function App() {
};
}, [setSharedSessionError]);
// Handle recipe decode events from main process
useEffect(() => {
const handleRecipeDecoded = (_event: IpcRendererEvent, ...args: unknown[]) => {
const decodedRecipe = args[0] as Recipe;
console.log('[App] Recipe decoded successfully:', decodedRecipe);
// Update the pair chat with the decoded recipe
setPairChat((prevChat) => ({
...prevChat,
recipeConfig: decodedRecipe,
title: decodedRecipe.title || 'Recipe Chat',
messages: [], // Start fresh for recipe
messageHistoryIndex: 0,
}));
// Navigate to pair view if not already there
if (window.location.hash !== '#/pair') {
window.location.hash = '#/pair';
}
};
const handleRecipeDecodeError = (_event: IpcRendererEvent, ...args: unknown[]) => {
const errorMessage = args[0] as string;
console.error('[App] Recipe decode error:', errorMessage);
// Show error to user - you could add a toast notification here
// For now, just log the error and navigate to recipes page
window.location.hash = '#/recipes';
};
window.electron.on('recipe-decoded', handleRecipeDecoded);
window.electron.on('recipe-decode-error', handleRecipeDecodeError);
return () => {
window.electron.off('recipe-decoded', handleRecipeDecoded);
window.electron.off('recipe-decode-error', handleRecipeDecodeError);
};
}, [setPairChat]);
useEffect(() => {
console.log('Setting up keyboard shortcuts');
const handleKeyDown = (event: KeyboardEvent) => {