authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-09 09:21:32-07:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-09 09:31:39-07:00
logb0e1b3368e47c8b470f988312309a9784421b69a
tree243d53d78666aa70f4e929745efc229aa2870a2a
parentce7b24bfb151cc5dfee54d669c3490611e74119e

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

1 files changed, 18 insertions(+), 4 deletions(-)

apps/web/src/components/Sidebar.tsx+18-4
......@@ -525,15 +525,29 @@ export default function Sidebar() {
525525 });
526526 await handleNewThread(projectId).catch(() => undefined);
527527 } catch (error) {
528 const description =
529 error instanceof Error ? error.message : "An error occurred while adding the project.";
528530 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 }
532540 return;
533541 }
534542 finishAddingProject();
535543 },
536 [focusMostRecentThreadForProject, handleNewThread, isAddingProject, projects],
544 [
545 focusMostRecentThreadForProject,
546 handleNewThread,
547 isAddingProject,
548 projects,
549 shouldBrowseForProjectImmediately,
550 ],
537551 );
538552
539553 const handleAddProject = () => {