| ... | @@ -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 | ); |
| 538 | | 552 | |
| 539 | const handleAddProject = () => { | 553 | const handleAddProject = () => { |