Fix project dropdown not refreshing after project creation or deletion
Project dropdown shows stale cached list after creating a new project or deleting a project within the same organization.
Changes
Modified src/lib/components/breadcrumbs.svelte
- Added check for current project existence in cached list to
shouldReloadProjectsreactive statement - Triggers reload when navigating to a project not present in the dropdown cache
- Compare cached project total with
allProjectsCountfrom page data to detect project creation/deletion
$: shouldReloadProjects = isLoadingProjects
? false
: currentProject && loadedProjects.projects.length
? // All projects in cache belong to same org, so check first project's teamId
loadedProjects.projects[0].teamId != currentProject.teamId ||
!loadedProjects.projects.some((p) => p.$id === currentProject.$id) ||
// Reload if total project count changed (handles creation/deletion)
(page.data?.allProjectsCount !== undefined &&
loadedProjects.total !== page.data.allProjectsCount)
: !loadedProjects.projects.length;
Previously only reloaded on team ID change or empty cache. Now also:
- Reloads when current project is missing from cache (handles project creation)
- Reloads when cached total differs from
allProjectsCount(handles both creation and deletion)
This approach uses the existing allProjectsCount from the layout data instead of complex navigation tracking, making the solution simpler and more maintainable.
- Fixes appwrite/console#2546
Original prompt
This section details on the original issue you should resolve
<issue_title>Project dropdown doesn't update</issue_title> <issue_description>### 👟 Reproduction steps
- Create a project
- Open the project dropdown
👍 Expected behavior
It has the new projects
👎 Actual Behavior
It doesn't:
![]()
Despite the org having 2 projects:
![]()
🎲 Appwrite version
Appwrite Cloud
💻 Operating system
Linux
🧱 Your Environment
No response
👀 Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [x] I have read the Code of Conduct</issue_description>
Comments on the Issue (you are @copilot in this section)
- Fixes appwrite/console#2546
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.