Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

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.

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?

  • 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)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@appwrite
Copy link

appwrite bot commented Nov 3, 2025

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Schedule functions to run as often as every minute with cron expressions

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: stnguyen90 <1477010+stnguyen90@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix project dropdown not updating with new projects Fix project dropdown not refreshing after project creation Nov 3, 2025
Copilot AI requested a review from stnguyen90 November 3, 2025 22:44
Copilot finished work on behalf of stnguyen90 November 3, 2025 22:44
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot make sure the dropdown refreshes after deleting a project too

Copilot AI and others added 3 commits November 21, 2025 18:12
Co-authored-by: stnguyen90 <1477010+stnguyen90@users.noreply.github.com>
Co-authored-by: stnguyen90 <1477010+stnguyen90@users.noreply.github.com>
Co-authored-by: stnguyen90 <1477010+stnguyen90@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 21, 2025

@copilot make sure the dropdown refreshes after deleting a project too

Fixed in ba2dc94. The dropdown now refreshes after project deletion by tracking navigation state. When a user navigates away from a project page (e.g., to the org page after deletion) and then back to another project, the cache is invalidated to force a reload.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • o1.ingest.sentry.io
    • Triggering command: /opt/hostedtoolcache/node/20.19.5/x64/bin/node node /home/REDACTED/work/console/console/node_modules/.bin/../vitest/vitest.mjs run (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Fix project dropdown not refreshing after project creation Fix project dropdown not refreshing after project creation or deletion Nov 21, 2025
Copilot AI requested a review from stnguyen90 November 21, 2025 18:19
Copilot finished work on behalf of stnguyen90 November 21, 2025 18:19
Comment on lines 245 to 266
// Invalidate cache when navigating from non-project page back to project page
// This handles cases like project deletion where user is redirected to org page
$: {
const isOnProjectPage = !!currentProject;
const hasNavigatedBackToProjects =
isOnProjectPage && !wasOnProjectPage && loadedProjects.projects.length > 0;
if (hasNavigatedBackToProjects) {
// Clear cache to force reload after being away from project pages
loadedProjects = { total: 0, projects: [] };
}
wasOnProjectPage = isOnProjectPage;
}
$: shouldReloadProjects = isLoadingProjects
? false
: currentProject && loadedProjects.projects.length
? loadedProjects.projects[0].teamId != currentProject.teamId
? // 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)
: !loadedProjects.projects.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this seems quite complicated. to detect if a project was deleted or created, can we just use the allProjectsCount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified in 2c721bf. Now using page.data.allProjectsCount to detect project creation/deletion by comparing it with the cached total. Removed the complex navigation tracking logic entirely.

Co-authored-by: stnguyen90 <1477010+stnguyen90@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 21, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • o1.ingest.sentry.io
    • Triggering command: /opt/hostedtoolcache/node/20.19.5/x64/bin/node node /home/REDACTED/work/console/console/node_modules/.bin/../vitest/vitest.mjs run (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from stnguyen90 November 21, 2025 22:39
Copilot finished work on behalf of stnguyen90 November 21, 2025 22:39
Ensure the project dropdown reloads correctly when creating/deleting projects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project dropdown doesn't update

2 participants