fix(mobile): block incompatible server connections (#11974)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-15 15:09:25 -07:00
1 parent e6ae764f47
commit 2c16c1d264
20 files changed
+234 -22

No files matched your search

@@ -35,6 +35,7 @@ function statusDotTone(state: ConnectionStatusDotState): {
haloColor: "rgba(245,158,11,0.5)",
};
case "offline":
case "unsupported":
case "error":
return {
dotColor: "#ef4444",
@@ -16,6 +16,8 @@ function noticeTitle(phase: EnvironmentConnectionPhase, environmentLabel: string
return `Connecting to ${environmentLabel}...`;
case "reconnecting":
return `Reconnecting to ${environmentLabel}...`;
case "unsupported":
return "Client not supported";
case "error":
return `${environmentLabel} is unavailable`;
case "available":
@@ -31,7 +33,7 @@ function noticeDetail(
error: string | null,
): string {
if (error) {
return `The app will keep retrying automatically. ${error}`;
return phase === "reconnecting" ? `The app will keep retrying automatically. ${error}` : error;
}
switch (phase) {
@@ -40,6 +42,8 @@ function noticeDetail(
case "connecting":
case "reconnecting":
return `The ${resourceName} will load as soon as the environment is ready.`;
case "unsupported":
return "Use compatible versions of the app and server to connect.";
case "available":
case "error":
return `Reconnect the environment to load the ${resourceName}.`;
@@ -95,7 +99,7 @@ export function EnvironmentConnectionNotice(props: {
) : null}
</Text>
{props.connection.phase !== "offline" ? (
{props.connection.phase !== "offline" && props.connection.phase !== "unsupported" ? (
<Pressable
accessibilityRole="button"
className="mt-1 rounded-full bg-subtle px-4 py-2.5 active:opacity-70"
@@ -21,6 +21,12 @@ export function connectionTone(state: RemoteClientConnectionState): StatusTone {
pillClassName: "bg-primary/10",
textClassName: "text-foreground-secondary",
};
case "unsupported":
return {
label: "Client not supported",
pillClassName: "bg-danger",
textClassName: "text-danger-foreground",
};
case "error":
return {
label: "Connection failed",
+6 -2
View File
@@ -169,11 +169,15 @@ function deriveEmptyState(props: {
if (
(catalogState.connectionState === "available" ||
catalogState.connectionState === "offline" ||
catalogState.connectionState === "error") &&
catalogState.connectionState === "error" ||
catalogState.connectionState === "unsupported") &&
!catalogState.hasLoadedShellSnapshot
) {
return {
title: "Environment unavailable",
title:
catalogState.connectionState === "unsupported"
? "Client not supported"
: "Environment unavailable",
detail:
catalogState.connectionError ??
"The saved environment is offline. Check the URL or start the environment, then retry.",
@@ -51,6 +51,8 @@ export function connectionFloatingStatus(input: {
};
case "offline":
return unavailable("You are offline");
case "unsupported":
return unavailable("Client not supported");
case "error":
return unavailable(
input.connectionError