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() {...@@ -525,15 +525,29 @@ export default function Sidebar() {
525 });525 });
526 await handleNewThread(projectId).catch(() => undefined);526 await handleNewThread(projectId).catch(() => undefined);
527 } catch (error) {527 } catch (error) {
528 const description =
529 error instanceof Error ? error.message : "An error occurred while adding the project.";
528 setIsAddingProject(false);530 setIsAddingProject(false);
529 setAddProjectError(531 if (shouldBrowseForProjectImmediately) {
530 error instanceof Error ? error.message : "An error occurred while adding the project.",532 toastManager.add({
531 );533 type: "error",
534 title: "Failed to add project",
535 description,
536 });
537 } else {
538 setAddProjectError(description);
539 }
532 return;540 return;
533 }541 }
534 finishAddingProject();542 finishAddingProject();
535 },543 },
536 [focusMostRecentThreadForProject, handleNewThread, isAddingProject, projects],544 [
545 focusMostRecentThreadForProject,
546 handleNewThread,
547 isAddingProject,
548 projects,
549 shouldBrowseForProjectImmediately,
550 ],
537 );551 );
538552
539 const handleAddProject = () => {553 const handleAddProject = () => {