-
Notifications
You must be signed in to change notification settings - Fork 3.6k
perf(mobile): smooth workspace resume #4760
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,17 @@ | ||
| import { SymbolView } from "../../components/AppSymbol"; | ||
| import { ActivityIndicator, Pressable } from "react-native"; | ||
| import { useEffect, useState } from "react"; | ||
| import { ActivityIndicator, Pressable, View } from "react-native"; | ||
| import Animated, { FadeInUp, FadeOutDown } from "react-native-reanimated"; | ||
|
|
||
| import { AppText as Text } from "../../components/AppText"; | ||
| import { useThemeColor } from "../../lib/useThemeColor"; | ||
| import type { WorkspaceState } from "../../state/workspaceModel"; | ||
| import { workspaceConnectionStatusLabel } from "./workspace-connection-status"; | ||
| import { | ||
| workspaceConnectionStatusLabel, | ||
| workspaceConnectionStatusPresentation, | ||
| } from "./workspace-connection-status"; | ||
|
|
||
| const TRANSIENT_STATUS_DELAY_MS = 350; | ||
|
|
||
| export function WorkspaceConnectionStatus(props: { | ||
| readonly state: WorkspaceState; | ||
|
|
@@ -22,6 +29,7 @@ export function WorkspaceConnectionStatus(props: { | |
| <Pressable | ||
| accessibilityHint="Opens environment settings" | ||
| accessibilityLabel={workspaceConnectionStatusLabel(props.state)} | ||
| accessibilityLiveRegion="polite" | ||
| accessibilityRole="button" | ||
| onPress={props.onPress} | ||
| className={ | ||
|
|
@@ -54,3 +62,55 @@ export function WorkspaceConnectionStatus(props: { | |
| </Pressable> | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Connection chrome that never participates in list or empty-state layout. | ||
| * Transient recovery is delayed to suppress healthy sub-350ms reconnect | ||
| * flashes; persistent and actionable states appear immediately. | ||
| */ | ||
| export function WorkspaceConnectionStatusOverlay(props: { | ||
| readonly state: WorkspaceState; | ||
| readonly onPress: () => void; | ||
| readonly bottomOffset: number; | ||
| }) { | ||
| const presentation = workspaceConnectionStatusPresentation(props.state); | ||
| const [presented, setPresented] = useState(presentation === "immediate"); | ||
| const [displayedState, setDisplayedState] = useState(props.state); | ||
|
|
||
| useEffect(() => { | ||
| if (presentation !== "hidden") { | ||
| setDisplayedState(props.state); | ||
| } | ||
| }, [presentation, props.state]); | ||
|
|
||
| useEffect(() => { | ||
| if (presentation === "hidden") { | ||
| setPresented(false); | ||
| return; | ||
| } | ||
| if (presentation === "immediate" || presented) { | ||
| setPresented(true); | ||
| return; | ||
| } | ||
| const timeout = setTimeout(() => setPresented(true), TRANSIENT_STATUS_DELAY_MS); | ||
| return () => clearTimeout(timeout); | ||
| }, [presentation, presented]); | ||
|
|
||
| if (!presented) return null; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overlay shows after status hiddenMedium Severity The Reviewed by Cursor Bugbot for commit 06c7cdc. Configure here. |
||
|
|
||
| return ( | ||
| <View | ||
| className="absolute inset-x-4 z-20 items-center" | ||
| pointerEvents="box-none" | ||
| style={{ bottom: props.bottomOffset }} | ||
| > | ||
| <Animated.View | ||
| className="w-full max-w-[430px]" | ||
| entering={FadeInUp.duration(180)} | ||
| exiting={FadeOutDown.duration(140)} | ||
| > | ||
| <WorkspaceConnectionStatus state={displayedState} onPress={props.onPress} /> | ||
| </Animated.View> | ||
| </View> | ||
| ); | ||
| } | ||


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.
Empty state shows duplicate spinners
Low Severity
The empty-state
ActivityIndicatorno longer checks whether connection status is shown. During a deferred connecting load, the empty copy still spins and, after 350ms,WorkspaceConnectionStatusOverlayadds a second spinner for the same recovery state.Reviewed by Cursor Bugbot for commit 06c7cdc. Configure here.