-
Notifications
You must be signed in to change notification settings - Fork 195
Fix: cross-region realtime ping for onboarding #2533
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
base: main
Are you sure you want to change the base?
Conversation
ConsoleProject ID: Tip You can use Avatars API to generate QR code for any text or URLs. |
WalkthroughThis pull request updates realtime channel subscriptions across five Svelte components within the platforms directory. Each file's Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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 |
src/routes/(console)/project-[region]-[project]/overview/platforms/createAndroid.svelte
Show resolved
Hide resolved
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 (1)
src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte (1)
160-178: Consider extracting shared realtime subscription logic.The
onMountsubscription pattern is duplicated identically across all five platform creation files (Flutter, Apple, Android, React Native, and Web). This could be refactored into a shared composable function or custom hook to reduce duplication and improve maintainability.Example refactor:
// In a shared utility file (e.g., $lib/utils/platformPing.ts) export function usePlatformPingSubscription( region: string, projectId: string, onSuccess: () => void ) { const unsubscribe = realtime.forConsole( region, ['console', 'project'], (response) => { if (response.events.includes(`projects.${projectId}.ping`)) { onSuccess(); invalidate(Dependencies.ORGANIZATION); invalidate(Dependencies.PROJECT); unsubscribe(); } } ); return unsubscribe; }Then in each component:
onMount(() => { const unsubscribe = usePlatformPingSubscription( page.params.region, projectId, () => { connectionSuccessful = true; } ); return () => { unsubscribe(); resetPlatformStore(); }; });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/routes/(console)/project-[region]-[project]/overview/platforms/createAndroid.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/overview/platforms/createApple.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/overview/platforms/createReactNative.svelte(1 hunks)src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte(1 hunks)
⏰ 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 (5)
src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte (1)
161-172: LGTM! Cross-region realtime subscription fix.The addition of the
'project'channel alongside'console'correctly addresses the cross-region ping issue described in the PR. The callback logic properly handles the ping event, sets connection status, invalidates dependencies, and cleans up the subscription.src/routes/(console)/project-[region]-[project]/overview/platforms/createApple.svelte (1)
95-106: LGTM! Cross-region realtime subscription fix.The multi-channel subscription correctly enables cross-region ping events. The callback logic appropriately handles connection success, dependency invalidation, and cleanup.
src/routes/(console)/project-[region]-[project]/overview/platforms/createReactNative.svelte (1)
122-133: LGTM! Cross-region realtime subscription fix.The updated subscription with both
'console'and'project'channels resolves the cross-region ping issue. The event handling and cleanup logic remain correct.src/routes/(console)/project-[region]-[project]/overview/platforms/createAndroid.svelte (1)
86-97: LGTM! Cross-region realtime subscription fix.The addition of the
'project'channel enables proper cross-region realtime event handling. The callback correctly processes ping events and manages the subscription lifecycle.src/routes/(console)/project-[region]-[project]/overview/platforms/createWeb.svelte (1)
207-218: LGTM! Cross-region realtime subscription fix.The multi-channel subscription correctly addresses the cross-region ping failure. The implementation is consistent with the other platform files and properly handles the connection lifecycle.
What does this PR do?
This:
Works in Frankfurt, but doesnt work in SFO region.
This PR fixes it.
Test Plan
Manual QA with multiregion instance
Related PRs and Issues
https://x.com/bandinopla/status/1984285463826600142
Have you read the Contributing Guidelines on issues?
Yes
Summary by CodeRabbit