console icon indicating copy to clipboard operation
console copied to clipboard

Fix project dropdown not refreshing after project creation or deletion

Open Copilot opened this issue 3 months ago • 4 comments

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 shouldReloadProjects reactive statement
  • Triggers reload when navigating to a project not present in the dropdown cache
  • Compare cached project total with allProjectsCount from 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

  1. Create a project
  2. Open the project dropdown

👍 Expected behavior

It has the new projects

👎 Actual Behavior

It doesn't:

Image

Despite the org having 2 projects:

Image

🎲 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?

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.

Copilot avatar Nov 03 '25 22:11 Copilot