Skip to content

Conversation

@lohanidamodar
Copy link
Member

@lohanidamodar lohanidamodar commented Nov 12, 2025

What does this PR do?

Fix: refresh billing page when organization dependency change

before: Invalidating organization was not refreshing the page because it kept local copy of organization

now: Invalidating organization correctly refreshes the page

Test Plan

  • Manually verified

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

YES

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where organization information on the billing page was not updating properly when changes occurred, ensuring payment method details and other billing information reflect current data.

before: Invalidating organization was not refreshing the page because it kept local copy of organization

now: Invalidating organization correctly refreshes the page
@appwrite
Copy link

appwrite bot commented Nov 12, 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

Roll back Sites deployments instantly by switching between versions

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Walkthrough

A single file was modified to make the organization variable reactive using Svelte's reactive statement syntax ($:). The variable now automatically updates whenever the input data.organization changes, cascading updates to dependent computed properties like defaultPaymentMethod and backupPaymentMethod.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that the reactive statement syntax is correctly implemented
  • Confirm that dependent properties (defaultPaymentMethod and backupPaymentMethod) update as expected when organization changes
  • Check for any unintended side effects from the reactivity update in the component's template or other logic

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix: refresh when organization dependency change' accurately describes the main change: making the organization variable reactive so the page refreshes when the organization dependency changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-refresh-alert

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/routes/(console)/organization-[organization]/billing/+page.svelte (1)

147-154: Consider using the reactive organization variable for consistency.

These child components receive data?.organization instead of the reactive organization variable defined at line 30. While functionally equivalent (both are reactive), using organization consistently throughout the component would improve code clarity.

Apply this diff to use the reactive variable consistently:

-    <PaymentMethods organization={data?.organization} methods={data?.paymentMethods} />
+    <PaymentMethods {organization} methods={data?.paymentMethods} />
     <BillingAddress
-        organization={data?.organization}
+        {organization}
         billingAddress={data?.billingAddress}
         locale={data?.locale}
         countryList={data?.countryList} />
     <TaxId />
-    <BudgetCap organization={data?.organization} currentPlan={data?.currentPlan} />
+    <BudgetCap {organization} currentPlan={data?.currentPlan} />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73552e5 and cd44516.

📒 Files selected for processing (1)
  • src/routes/(console)/organization-[organization]/billing/+page.svelte (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2413
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/header.svelte:54-58
Timestamp: 2025-10-13T05:16:07.656Z
Learning: In SvelteKit apps, shared layout components (like headers) that use `$derived(page.data.*)` should use optional chaining when accessing properties that may not be present on all routes. During page transitions, reactive statements can briefly evaluate with different page.data structures, so optional chaining prevents runtime errors when navigating between routes with different data shapes (e.g., between `/databases` and `/databases/database-[database]`).
📚 Learning: 2025-10-05T09:41:40.439Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2398
File: src/routes/(console)/verify-email/+page.svelte:48-51
Timestamp: 2025-10-05T09:41:40.439Z
Learning: In SvelteKit 5, `page` imported from `$app/state` is a reactive state object (using runes), not a store. It should be accessed as `page.data` without the `$` prefix, unlike the store-based `$page` from `$app/stores` in earlier versions.

Applied to files:

  • src/routes/(console)/organization-[organization]/billing/+page.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: e2e
  • GitHub Check: build
🔇 Additional comments (2)
src/routes/(console)/organization-[organization]/billing/+page.svelte (2)

29-30: LGTM! Correctly fixes the reactivity issue.

The reactive statement ensures organization updates whenever data.organization changes, which will cascade to dependent reactive properties like defaultPaymentMethod and backupPaymentMethod. This correctly addresses the issue where invalidating the organization dependency didn't refresh the page.


32-39: The comment now has clear context.

The comment questioning why these are reactive is now answered by the change at line 30. These reactive statements need to be reactive because they depend on organization.paymentMethodId and organization.backupPaymentMethodId, and organization itself is now reactive. When data.organization changes, these derived values will correctly recompute.

@lohanidamodar lohanidamodar merged commit 9e5877d into main Nov 12, 2025
4 checks passed
@lohanidamodar lohanidamodar deleted the fix-refresh-alert branch November 12, 2025 05:00
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.

3 participants