Skip to content

Conversation

@Meldiron
Copy link
Contributor

@Meldiron Meldiron commented Oct 31, 2025

What does this PR do?

This:

CleanShot 2025-10-31 at 17 18 14@2x

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

  • Improvements
    • Enhanced real-time event synchronization across all platform creation workflows (Android, Apple, Flutter, React Native, Web) to listen to additional channels for more reliable project connectivity and updates.

@appwrite
Copy link

appwrite bot commented Oct 31, 2025

Console

Project ID: 688b7bf400350cbd60e9

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

Tip

You can use Avatars API to generate QR code for any text or URLs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

This pull request updates realtime channel subscriptions across five Svelte components within the platforms directory. Each file's onMount subscription is modified to listen to multiple channels by changing the second parameter of realtime.forConsole from a single string 'console' to an array ['console', 'project']. The ping event detection logic, connection handling, dependency invalidation, and cleanup mechanisms remain functionally identical in all files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that the ['console', 'project'] channel array is the appropriate set for all these platform-specific components
  • Confirm the change is applied consistently across all five files with no variations or missed files
  • Check that the callback handler logic does not require modifications to process events from multiple channels

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Fix: cross-region realtime ping for onboarding" directly and accurately describes the main change in the changeset. The modifications across five platform-specific onboarding files (Android, Apple, Flutter, React Native, and Web) all follow the same pattern: updating the realtime subscription to listen to multiple channels ['console', 'project'] instead of a single 'console' channel. This change aligns precisely with the stated purpose of fixing a cross-region realtime ping issue that was affecting the onboarding process. The title is concise, specific, and clearly communicates the primary intent without being vague or overly broad.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-cross-region-ping

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)/project-[region]-[project]/overview/platforms/createFlutter.svelte (1)

160-178: Consider extracting shared realtime subscription logic.

The onMount subscription 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

📥 Commits

Reviewing files that changed from the base of the PR and between 60d0bdb and a3267cf.

📒 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.

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.

2 participants