The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 08:45 UTC
Show toast when immediate project add fails
- Use a toast error for add-project failures during immediate folder browse - Keep inline add-project error state for non-immediate flows - Include `shouldBrowseForProjectImmediately` in callback dependencies
Julius Marminge committed
Mar 9, 2026 at 09:21 UTC
b0e1b3368e47c8b470f988312309a9784421b69a
1 file changed
+18
-4
apps/web/src/components/Sidebar.tsx
+18
-4
@@ -525,15 +525,29 @@ export default function Sidebar() {
525
});
526
await handleNewThread(projectId).catch(() => undefined);
527
} catch (error) {
528
+ const description =
529
+ error instanceof Error ? error.message : "An error occurred while adding the project.";
530
setIsAddingProject(false);
529
- setAddProjectError(
530
- error instanceof Error ? error.message : "An error occurred while adding the project.",
531
- );
531
+ if (shouldBrowseForProjectImmediately) {
532
+ toastManager.add({
533
+ type: "error",
534
+ title: "Failed to add project",
535
+ description,
536
+ });
537
+ } else {
538
+ setAddProjectError(description);
539
+ }
540
return;
541
}
542
finishAddingProject();
543
},
536
- [focusMostRecentThreadForProject, handleNewThread, isAddingProject, projects],
544
+ [
545
+ focusMostRecentThreadForProject,
546
+ handleNewThread,
547
+ isAddingProject,
548
+ projects,
549
+ shouldBrowseForProjectImmediately,
550
+ ],
551
);
552
553
const handleAddProject = () => {