-
Notifications
You must be signed in to change notification settings - Fork 198
Feat: downgrade feedback #2636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: downgrade feedback #2636
Conversation
Console (appwrite/console)Project ID: Tip JWT tokens let functions act on behalf of users while preserving their permissions |
WalkthroughAdds an Organizations client to the console SDK and updates package.json to point to a different Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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. Comment |
There was a problem hiding this 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 (2)
src/routes/(console)/organization-[organization]/change-plan/+page.svelte (2)
142-152: Add error handling for downgrade feedback.The
trackDowngradeFeedbackfunction lacks error handling. If the SDK call fails, it will propagate to thedowngrade()function's catch block, potentially causing the entire downgrade flow to fail even though feedback is non-critical.Consider wrapping the SDK call in try/catch to prevent feedback errors from blocking the downgrade:
async function trackDowngradeFeedback() { + try { await sdk.forConsole.organizations.createDowngradeFeedback({ organizationId: data.organization.$id, reason: feedbackDowngradeOptions.find( (option) => option.value === feedbackDowngradeReason )?.label, message: feedbackMessage ?? '', fromPlanId: data.organization.billingPlan, toPlanId: selectedPlan }); + } catch (error) { + console.warn('Failed to submit downgrade feedback:', error); + } }
145-147: Add safety check for reason mapping.The reason mapping could return
undefinediffeedbackDowngradeReasondoesn't match any option value. While this may be prevented by form validation, adding a fallback improves robustness.Apply this diff to add a fallback:
reason: feedbackDowngradeOptions.find( (option) => option.value === feedbackDowngradeReason - )?.label, + )?.label ?? feedbackDowngradeReason ?? 'Not specified',
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
package.json(1 hunks)src/lib/stores/sdk.ts(2 hunks)src/routes/(console)/organization-[organization]/change-plan/+page.svelte(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-26T06:48:57.938Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2373
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte:629-631
Timestamp: 2025-09-26T06:48:57.938Z
Learning: In the Appwrite console codebase using appwrite.io/pink-svelte, the Icon component automatically handles CSS variable names passed to its color prop by internally wrapping them with var(). Therefore, passing '--some-css-variable' as a string to the Icon color prop works correctly without needing to manually wrap it with var().
Applied to files:
package.json
🔇 Additional comments (4)
src/lib/stores/sdk.ts (2)
26-26: LGTM: Organizations SDK properly integrated.The Organizations client is correctly imported and initialized, following the same pattern as other SDK clients. This enables the console SDK to expose the downgrade feedback functionality used in the page component.
Also applies to: 100-100
25-25: Verify Realtime addition is within PR scope.The Realtime client import and initialization appear unrelated to the PR's stated objective of adding "downgrade feedback" functionality. While the implementation follows the correct pattern, confirm whether this change is intentional or should be part of a separate PR.
Also applies to: 99-99
package.json (1)
25-25: Verify the updated dependency commit contains the Organizations SDK.The dependency for
@appwrite.io/consolehas been updated to commitacef319. Ensure this commit exists and includes the Organizations SDK with thecreateDowngradeFeedbackmethod that is used in the page component.Run the following script to verify the commit and check for the Organizations SDK:
src/routes/(console)/organization-[organization]/change-plan/+page.svelte (1)
143-151: Verify the SDK method signature and availability.Ensure the
createDowngradeFeedbackmethod exists onsdk.forConsole.organizationswith the expected signature accepting{ organizationId, reason, message, fromPlanId, toPlanId }.Run the following script to verify the method exists in the Organizations SDK:

What does this PR do?
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
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?
(Write your answer here.)
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.