| ... | ... | @@ -525,15 +525,29 @@ export default function Sidebar() { |
| 525 | 525 | }); |
| 526 | 526 | await handleNewThread(projectId).catch(() => undefined); |
| 527 | 527 | } catch (error) { |
| 528 | const description = |
| 529 | error instanceof Error ? error.message : "An error occurred while adding the project."; |
| 528 | 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 | } |
| 532 | 540 | return; |
| 533 | 541 | } |
| 534 | 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 | 553 | const handleAddProject = () => { |