Skip to content

Commit 14793a3

Browse files
committed
chore: resolve merge conflicts with main
2 parents 633c059 + 13aa882 commit 14793a3

472 files changed

Lines changed: 27384 additions & 26507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,31 @@ jobs:
268268
- name: Setup Vite+
269269
uses: ./.github/actions/setup-ci-deps
270270

271+
# The browser project runs React tests in headless Chromium. Same cache key as
272+
# test_server, so both jobs share one downloaded browser.
273+
- name: Resolve Playwright version
274+
id: playwright_version
275+
run: echo "version=$(node -p "require('./apps/web/node_modules/playwright/package.json').version")" >> "$GITHUB_OUTPUT"
276+
277+
- name: Cache Chromium
278+
id: chromium_cache
279+
uses: actions/cache@v6
280+
with:
281+
path: ~/.cache/ms-playwright
282+
key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
283+
284+
- name: Install Chromium for web browser tests
285+
if: steps.chromium_cache.outputs.cache-hit != 'true'
286+
run: node apps/web/node_modules/playwright/cli.js install --only-shell chromium
287+
288+
- name: Install missing Chromium system dependencies
289+
run: |
290+
browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
291+
test -n "$browser"
292+
if ldd "$browser" | grep '=> not found'; then
293+
node apps/web/node_modules/playwright/cli.js install-deps chromium
294+
fi
295+
271296
- name: Test
272297
run: vp run --filter @t3tools/web test
273298

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ jobs:
297297
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
298298
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config build-essential
299299
300+
# The web package's browser project runs React tests in headless Chromium.
301+
- name: Install Chromium for web browser tests
302+
run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium
303+
300304
- name: Test
301305
run: vp run --parallel --concurrency-limit 4 --filter '!t3' --filter '!@t3tools/monorepo' test
302306

‎apps/mobile/src/components/ui/MenuPopup.android.tsx‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,31 @@ import {
88
Text,
99
} from "@expo/ui/jetpack-compose";
1010
import { defaultMinSize, padding, size, width } from "@expo/ui/jetpack-compose/modifiers";
11-
import { View } from "react-native";
11+
import { Pressable } from "react-native";
1212
import { resolveScaledTextRole } from "../../lib/appearancePreferences";
1313

1414
import { useAndroidControlSizing } from "./useAndroidControlSizing";
1515
import { useAppearancePreferences } from "../../features/settings/appearance/AppearancePreferencesProvider";
1616
import type { MenuPopupProps } from "./MenuPopup";
1717
import { isAppSymbolName, SymbolView, type AppSymbolName } from "./AppSymbol";
1818

19+
// The glyph is a React Native view hosted in the Compose row, and its native host consumes
20+
// every touch over it, so the row's onClick never sees a tap on the icon. The glyph runs the
21+
// row's action itself; the row stays the accessible element.
1922
function MenuIcon(props: {
2023
readonly name: AppSymbolName;
24+
readonly onPress: () => void;
2125
readonly destructive?: boolean;
2226
readonly disabled?: boolean;
2327
}) {
2428
const { iconSize } = useAndroidControlSizing();
2529
return (
2630
<RNHostView matchContents modifiers={[size(iconSize, iconSize)]}>
27-
<View
31+
<Pressable
32+
accessible={false}
33+
focusable={false}
34+
disabled={props.disabled}
35+
onPress={props.onPress}
2836
style={{ width: iconSize, height: iconSize }}
2937
importantForAccessibility="no-hide-descendants"
3038
>
@@ -40,7 +48,7 @@ function MenuIcon(props: {
4048
: "accent-foreground"
4149
}
4250
/>
43-
</View>
51+
</Pressable>
4452
</RNHostView>
4553
);
4654
}
@@ -60,7 +68,7 @@ export function MenuPopup(props: MenuPopupProps) {
6068
{props.parent ? (
6169
<DropdownMenuItem onClick={props.onBack} modifiers={itemModifiers}>
6270
<DropdownMenuItem.LeadingIcon>
63-
<MenuIcon name="arrow.left" />
71+
<MenuIcon name="arrow.left" onPress={props.onBack} />
6472
</DropdownMenuItem.LeadingIcon>
6573
<DropdownMenuItem.Text>
6674
<Text color={foreground} style={{ typography: "bodyLarge", ...body }}>
@@ -88,6 +96,7 @@ export function MenuPopup(props: MenuPopupProps) {
8896
<DropdownMenuItem.LeadingIcon>
8997
<MenuIcon
9098
name={action.image}
99+
onPress={() => props.onPress(action)}
91100
destructive={action.attributes?.destructive}
92101
disabled={action.attributes?.disabled}
93102
/>
@@ -116,11 +125,19 @@ export function MenuPopup(props: MenuPopupProps) {
116125
</DropdownMenuItem.Text>
117126
{(action.subactions?.length ?? 0) > 0 ? (
118127
<DropdownMenuItem.TrailingIcon>
119-
<MenuIcon name="chevron.right" disabled={action.attributes?.disabled} />
128+
<MenuIcon
129+
name="chevron.right"
130+
onPress={() => props.onPress(action)}
131+
disabled={action.attributes?.disabled}
132+
/>
120133
</DropdownMenuItem.TrailingIcon>
121134
) : action.state === "on" ? (
122135
<DropdownMenuItem.TrailingIcon>
123-
<MenuIcon name="checkmark" disabled={action.attributes?.disabled} />
136+
<MenuIcon
137+
name="checkmark"
138+
onPress={() => props.onPress(action)}
139+
disabled={action.attributes?.disabled}
140+
/>
124141
</DropdownMenuItem.TrailingIcon>
125142
) : null}
126143
</DropdownMenuItem>

‎apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function ConnectionsNewRouteScreen({
155155
);
156156

157157
const connectAndClose = useCallback(
158-
async (pairingUrl: string, replaceWithHome: boolean) => {
158+
async (pairingUrl: string) => {
159159
setIsSubmitting(true);
160160
onChangeConnectionPairingUrl(pairingUrl);
161161
try {
@@ -166,7 +166,9 @@ export function ConnectionsNewRouteScreen({
166166
: Haptics.NotificationFeedbackType.Error,
167167
);
168168
if (AsyncResult.isSuccess(result)) {
169-
if (replaceWithHome || !navigation.canGoBack()) {
169+
// Return to whatever opened the sheet. Replacing it with Home would
170+
// nest Home inside any sheet still below it.
171+
if (!navigation.canGoBack()) {
170172
navigation.dispatch(StackActions.replace("Home"));
171173
} else {
172174
navigation.goBack();
@@ -180,7 +182,7 @@ export function ConnectionsNewRouteScreen({
180182
);
181183

182184
const handleSubmit = useCallback(async () => {
183-
await connectAndClose(buildPairingUrl(hostInput, codeInput), false);
185+
await connectAndClose(buildPairingUrl(hostInput, codeInput));
184186
}, [codeInput, connectAndClose, hostInput]);
185187

186188
useEffect(() => {
@@ -189,7 +191,7 @@ export function ConnectionsNewRouteScreen({
189191
}
190192

191193
attemptedAutoConnectRef.current = routePairingUrl;
192-
void connectAndClose(routePairingUrl, true);
194+
void connectAndClose(routePairingUrl);
193195
}, [connectAndClose, routePairingUrl, shouldAutoConnect]);
194196

195197
return (

‎apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import {
55
type AtomCommandResult,
66
} from "@t3tools/client-runtime/state/runtime";
77
import type { ProviderAuthResponse, ServerProvider } from "@t3tools/contracts";
8+
import { useAtomValue } from "@effect/atom-react";
89
import { useRef, useState } from "react";
910
import { Linking, Pressable, ScrollView, TextInput, View } from "react-native";
1011
import { useSafeAreaInsets } from "react-native-safe-area-context";
1112

1213
import { AppText as Text } from "../../components/ui/AppText";
1314
import { ScreenScrollView } from "../../components/ui/ScreenScrollView";
15+
import { environmentPresentations } from "../../state/presentation";
1416
import { useEnvironmentQuery } from "../../state/query";
1517
import { serverEnvironment } from "../../state/server";
1618
import { useAtomCommand } from "../../state/use-atom-command";
@@ -25,6 +27,7 @@ import { useSettingsEnvironmentFilter, type SettingsTarget } from "./settings-en
2527

2628
export function SettingsProviderAccountsRouteScreen() {
2729
const { selectedTargets } = useSettingsEnvironmentFilter();
30+
const providersByEnvironment = useAtomValue(environmentPresentations.providersByEnvironmentAtom);
2831
const insets = useSafeAreaInsets();
2932
return (
3033
<>
@@ -41,7 +44,7 @@ export function SettingsProviderAccountsRouteScreen() {
4144
) : (
4245
selectedTargets.map((environment) => (
4346
<SettingsSection key={environment.environmentId} title={environment.label}>
44-
{environment.serverConfig.providers
47+
{(providersByEnvironment.get(environment.environmentId) ?? [])
4548
.filter(
4649
(provider) =>
4750
provider.setup?.canAuthenticate ||
@@ -54,7 +57,7 @@ export function SettingsProviderAccountsRouteScreen() {
5457
provider={provider}
5558
/>
5659
))}
57-
{!environment.serverConfig.providers.some(
60+
{!(providersByEnvironment.get(environment.environmentId) ?? []).some(
5861
(provider) =>
5962
provider.setup?.canAuthenticate ||
6063
(provider.driver === "acpRegistry" && provider.installed),

‎apps/mobile/src/features/threads/QuestionAttachments.tsx‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { convertPastedImagesToAttachments } from "../../lib/composerImages";
66
import { PROVIDER_SEND_TURN_MAX_ATTACHMENTS, type UserInputQuestion } from "@t3tools/contracts";
77
import { useAtomValue } from "@effect/atom-react";
88
import { View } from "react-native";
9-
import { useEffect, useRef, useState } from "react";
9+
import { useEffect, useEffectEvent, useRef, useState } from "react";
1010
import { ComposerAttachmentButton } from "./ComposerAttachmentButton";
1111
import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
1212
import { pickComposerFiles, pickComposerMedia } from "../../lib/composerImages";
@@ -49,6 +49,14 @@ export function QuestionAttachments(props: {
4949
props.requestId,
5050
props.question.id,
5151
]);
52+
// A focused input that unmounts never delivers its onBlur, so release focus here or
53+
// the screen would keep treating the keyboard as owned by a removed input.
54+
const focusedRef = useRef(false);
55+
const onInputFocusChange = props.onInputFocusChange;
56+
const releaseFocus = useEffectEvent(() => {
57+
if (focusedRef.current) onInputFocusChange?.(false);
58+
});
59+
useEffect(() => () => releaseFocus(), []);
5260
const pickerScope = useRef<{ key: string; active: boolean } | null>(null);
5361
useEffect(() => {
5462
const scope = { key: scopeKey, active: true };
@@ -197,8 +205,14 @@ export function QuestionAttachments(props: {
197205
submitBehavior={props.question.initialAnswer !== undefined ? "newline" : undefined}
198206
editable={!props.disabled}
199207
onChangeText={props.onChangeText}
200-
onFocus={() => props.onInputFocusChange?.(true)}
201-
onBlur={() => props.onInputFocusChange?.(false)}
208+
onFocus={() => {
209+
focusedRef.current = true;
210+
onInputFocusChange?.(true);
211+
}}
212+
onBlur={() => {
213+
focusedRef.current = false;
214+
onInputFocusChange?.(false);
215+
}}
202216
placeholder="Or type a custom answer"
203217
className="min-h-[54px] rounded-2xl border border-input-border bg-input px-3.5 py-3 font-sans text-base text-foreground"
204218
/>

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,19 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
363363
// Android can swallow the IME hide callbacks when the app is backgrounded mid keyboard-hide
364364
// (the reported repro: send — which blurs and starts the hide — then Home within a second). The
365365
// keyboard library's height AND visibility then stay frozen open, so gating the sticky
366-
// translation on visibility alone still strands the composer after resume.
366+
// translation on visibility alone still strands the composer after resume. An input that kept
367+
// focus through the switch is exempt: Android restores its keyboard unchanged, so no keyboard
368+
// or focus event would ever lift the quarantine. Hiding the keyboard with Back keeps focus, so
369+
// Back then Home mid-hide takes the exemption and can still strand the composer.
367370
const [keyboardStateSuspect, setKeyboardStateSuspect] = useState(false);
371+
const ownedInputFocusedRef = useRef(false);
368372
useEffect(() => {
369373
if (Platform.OS !== "android") {
370374
return;
371375
}
372376
const subscription = AppState.addEventListener("change", (state) => {
373377
if (state === "active") {
374-
setKeyboardStateSuspect(true);
378+
setKeyboardStateSuspect(!ownedInputFocusedRef.current);
375379
}
376380
});
377381
return () => {
@@ -382,6 +386,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
382386
setKeyboardStateSuspect(false);
383387
}, [isKeyboardVisible, liveKeyboardHeight]);
384388
const handleOwnedInputFocusChange = useCallback((focused: boolean) => {
389+
ownedInputFocusedRef.current = focused;
385390
if (focused) {
386391
setKeyboardStateSuspect(false);
387392
}

‎apps/mobile/src/features/usage/ChatGptUsageSummary.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function ChatGptUsageSummary({
1111
}: {
1212
selectedEnvironmentIds: ReadonlySet<EnvironmentId> | null;
1313
}) {
14-
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
14+
const presentations = useAtomValue(environmentPresentations.presentationsWithProvidersAtom);
1515
const selected =
1616
selectedEnvironmentIds === null
1717
? presentations

‎apps/mobile/src/features/usage/UsageLimitsPooled.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export function UsageLimitsSection({
222222
readonly selectedEnvironmentIds: ReadonlySet<EnvironmentId> | null;
223223
readonly cursorPrompt?: ReactNode;
224224
}) {
225-
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
225+
const presentations = useAtomValue(environmentPresentations.presentationsWithProvidersAtom);
226226
const selected =
227227
selectedEnvironmentIds === null
228228
? presentations
@@ -345,7 +345,7 @@ type AccountScreenProps = StaticScreenProps<{
345345

346346
export function UsageLimitAccountScreen({ route }: AccountScreenProps) {
347347
const insets = useSafeAreaInsets();
348-
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
348+
const presentations = useAtomValue(environmentPresentations.presentationsWithProvidersAtom);
349349
const { accountKey, windowId, windowKind, environmentIds, now } = route.params;
350350
const selectedIds =
351351
environmentIds === null ? null : new Set(environmentIds.map((id) => EnvironmentId.make(id)));

‎apps/mobile/src/widgets/SubscriptionUsageCoordinator.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { buildSubscriptionUsageSnapshot } from "./subscriptionUsageSnapshot";
1212
// Isolate quota changes from the much busier thread/config presentation stream.
1313
const snapshotAtom = Atom.make((get) =>
1414
buildSubscriptionUsageSnapshot(
15-
get(environmentPresentations.presentationsAtom),
15+
get(environmentPresentations.presentationsWithProvidersAtom),
1616
Linking.createURL("settings/usage", { queryParams: { tab: "limits" } }),
1717
Platform.OS === "android" ? Infinity : 6,
1818
),

0 commit comments

Comments
 (0)