Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThe update enhances the cache invalidation logic in the workspace switcher component. Now, in addition to invalidating the current user's organization data, it also invalidates the overview and rate limit namespace queries upon a successful workspace change, ensuring these caches are refreshed before the page reloads. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (team-switcher)
participant changeWorkspace Mutation
participant Cache (utils)
participant Router
User->>UI (team-switcher): Selects new workspace
UI (team-switcher)->>changeWorkspace Mutation: Trigger mutation
changeWorkspace Mutation-->>UI (team-switcher): onSuccess
UI (team-switcher)->>Cache (utils): Invalidate user.getCurrentUser
UI (team-switcher)->>Cache (utils): Invalidate api.overview.query
UI (team-switcher)->>Cache (utils): Invalidate ratelimit.namespace.query
UI (team-switcher)->>Router: Reload page
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/dashboard/components/navigation/sidebar/team-switcher.tsx (1)
65-67: Looks good, consider adding a more descriptive commentThe added cache invalidations correctly address the issue of ensuring sidebar data is refreshed when changing workspaces. Adding these invalidations before the page reload ensures the sidebar queries will have fresh data.
Consider updating the comment to be more comprehensive about why all these invalidations are needed:
- // refresh the check mark by invalidating the current user's org data + // Invalidate workspace-dependent queries to ensure fresh data after workspace switch utils.user.getCurrentUser.invalidate(); utils.api.overview.query.invalidate(); utils.ratelimit.namespace.query.invalidate();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/dashboard/components/navigation/sidebar/team-switcher.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Test Packages / Test ./packages/nextjs
- GitHub Check: Test Packages / Test ./apps/dashboard
- GitHub Check: Test Packages / Test ./internal/clickhouse
- GitHub Check: Test Packages / Test ./packages/hono
- GitHub Check: Test Packages / Test ./internal/id
- GitHub Check: Test Packages / Test ./packages/api
- GitHub Check: Test Packages / Test ./packages/cache
- GitHub Check: Test Packages / Test ./internal/keys
- GitHub Check: autofix
- GitHub Check: Analyze (javascript-typescript)
|
it crashes when I switch workspace |
mcstepp
left a comment
There was a problem hiding this comment.
Tested in vercel with multiple workspaces and APIs. Looks good
|
@chronark hmm locally I didn't have that lemme chekc preview again |
|
works fine for me |
|
It didn't crash for me, and I created multiple new workspaces and APIs |
|
I need to check Vercel logs |
|
TypeError: Cannot read properties of null (reading ‘requestsPerMonth’) |
|
ah might be cause the |
|
offf billing |
|
it doesn’t have a quota |
|
yeah |
|
in staging anyways |
|
:ship-it: |
|
gotcha. I'll check this tomorrow 🫡 |
|
I noticed the DB mismatch on the slug-based API route in the logs... you're on api_xyz owned by org_1, switch to org_2, and api_xyz route throws the error. Doesn't seem to be a redirect off that page when you're not on the same workspace |
What does this PR do?
Revalidates sidebar queries when changing workspacex
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
Summary by CodeRabbit