The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
fix(mobile): a settings row an older environment left mixed can be set off (#39755)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Peyton Lamb committed
Nov 20, 2026 at 10:26 UTC
7085c477768d0986956d113d072bc301b2841823
13 files changed
+94
-6
apps/mobile/src/components/ui/ListToggleRow.test.tsx
new
+55
@@ -0,0 +1,55 @@
1
+import { act, type ReactNode } from "react";
2
+import { createRoot } from "react-dom/client";
3
+import { expect, it, vi } from "vite-plus/test";
4
+
5
+vi.mock("react-native", () => ({
6
+ Pressable: (props: {
7
+ readonly children?: ReactNode;
8
+ readonly accessibilityLabel?: string;
9
+ readonly onPress: () => void;
10
+ }) => (
11
+ <button aria-label={props.accessibilityLabel} onClick={props.onPress}>
12
+ {props.children}
13
+ </button>
14
+ ),
15
+}));
16
+vi.mock("./AppText", () => ({ AppText: (props: { children?: ReactNode }) => props.children }));
17
+vi.mock("./ListRowLayout", () => ({
18
+ ListRowLayout: (props: { accessory?: ReactNode }) => props.accessory,
19
+}));
20
+vi.mock("./ThemedSwitch", () => ({ ThemedSwitch: () => null }));
21
+
22
+import { ListToggleRow } from "./ListToggleRow";
23
+
24
+it("sets a mixed row on, then off when an older environment drops it", () => {
25
+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
26
+ const container = document.createElement("div");
27
+ const root = createRoot(container);
28
+ const saves: boolean[] = [];
29
+ try {
30
+ // The older environment dropped the unknown key, so the row stays mixed after every save.
31
+ act(() =>
32
+ root.render(
33
+ <ListToggleRow
34
+ label="Clone into host folders"
35
+ value={null}
36
+ onValueChange={(value) => saves.push(value)}
37
+ />,
38
+ ),
39
+ );
40
+ const button = () => container.querySelector("button")!;
41
+
42
+ act(() => button().click());
43
+ const offer = { text: button().textContent, label: button().getAttribute("aria-label") };
44
+ act(() => button().click());
45
+
46
+ expect(saves).toEqual([true, false]);
47
+ expect(offer).toEqual({
48
+ text: "Mixed · Set off",
49
+ label: "Set Clone into host folders off for selected environments",
50
+ });
51
+ } finally {
52
+ act(() => root.unmount());
53
+ vi.unstubAllGlobals();
54
+ }
55
+});
apps/mobile/src/components/ui/ListToggleRow.tsx
+18
-6
@@ -1,10 +1,15 @@
1
import { T, useGT } from "gt-react-native";
2
+import { useState } from "react";
3
import { Pressable } from "react-native";
4
5
import { AppText } from "./AppText";
6
import { ListRowLayout, type ListRowContentProps } from "./ListRowLayout";
7
import { ThemedSwitch } from "./ThemedSwitch";
8
9
+/**
10
+ * A mixed row flips the value last picked on it, so a pick that some environments dropped can be
11
+ * undone. Before any pick, it sets the value on everywhere.
12
+ */
13
export function ListToggleRow(
14
props: Omit<ListRowContentProps, "detail"> & {
15
readonly value: boolean | null;
@@ -12,6 +17,11 @@ export function ListToggleRow(
17
},
18
) {
19
const gt = useGT();
20
+ const [picked, setPicked] = useState(false);
21
+ const pick = (value: boolean) => {
22
+ setPicked(value);
23
+ props.onValueChange(value);
24
+ };
25
return (
26
<ListRowLayout
27
icon={props.icon}
@@ -21,18 +31,20 @@ export function ListToggleRow(
31
accessory={
32
props.value === null ? (
33
<Pressable
24
- accessibilityLabel={gt("Set {label} on for selected environments", {
25
- label: props.label,
26
- })}
34
+ accessibilityLabel={
35
+ picked
36
+ ? gt("Set {label} off for selected environments", { label: props.label })
37
+ : gt("Set {label} on for selected environments", { label: props.label })
38
+ }
39
accessibilityRole="button"
40
accessibilityHint={props.description}
41
accessibilityState={{ disabled: Boolean(props.disabled) }}
42
disabled={props.disabled}
43
className="rounded-full bg-subtle px-3 py-2 active:opacity-70"
32
- onPress={() => props.onValueChange(true)}
44
+ onPress={() => pick(!picked)}
45
>
46
<AppText className="text-sm font-t3-medium text-foreground">
35
- <T>Mixed · Set on</T>
47
+ {picked ? <T>Mixed · Set off</T> : <T>Mixed · Set on</T>}
48
</AppText>
49
</Pressable>
50
) : (
@@ -40,7 +52,7 @@ export function ListToggleRow(
52
accessibilityLabel={props.label}
53
accessibilityHint={props.description}
54
disabled={props.disabled}
43
- onValueChange={props.onValueChange}
55
+ onValueChange={pick}
56
value={props.value}
57
/>
58
)
apps/mobile/src/i18n/translations/de.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Verbinde dich erneut mit dieser Umgebung und versuch es noch einmal. Die Datei wurde möglicherweise verschoben oder gelöscht.",
1713
"2b29584d2bcea749": "Die Datei wurde unter {path} nicht gefunden.",
1714
"61026d122846876c": "Hänge die Datei erneut an und versuch es noch einmal.",
1715
+ "d0872cb98b34eae8": "{label} für ausgewählte Umgebungen ausschalten",
1716
"a9129aaa7c955e46": "{label} für ausgewählte Umgebungen einschalten",
1717
+ "53207498f814efe0": "Gemischt · Ausschalten",
1718
"fd569def3acc6750": "Gemischt · Einschalten",
1719
"8eebcd051255ba20": "Nachricht schließen",
1720
"8711a1de99862971": "{label} verringern",
apps/mobile/src/i18n/translations/en.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Reconnect to this environment and try again. The file may have been moved or deleted.",
1713
"2b29584d2bcea749": "The file was not found at {path}.",
1714
"61026d122846876c": "Attach the file again and retry.",
1715
+ "d0872cb98b34eae8": "Set {label} off for selected environments",
1716
"a9129aaa7c955e46": "Set {label} on for selected environments",
1717
+ "53207498f814efe0": "Mixed · Set off",
1718
"fd569def3acc6750": "Mixed · Set on",
1719
"8eebcd051255ba20": "Dismiss message",
1720
"8711a1de99862971": "Decrease {label}",
apps/mobile/src/i18n/translations/es.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Vuelve a conectarte a este entorno e inténtalo de nuevo. Puede que el archivo se haya movido o eliminado.",
1713
"2b29584d2bcea749": "No se encontró el archivo en {path}.",
1714
"61026d122846876c": "Vuelve a adjuntar el archivo y reinténtalo.",
1715
+ "d0872cb98b34eae8": "Desactivar {label} en los entornos seleccionados",
1716
"a9129aaa7c955e46": "Activar {label} en los entornos seleccionados",
1717
+ "53207498f814efe0": "Mixto · Desactivar",
1718
"fd569def3acc6750": "Mixto · Activar",
1719
"8eebcd051255ba20": "Descartar mensaje",
1720
"8711a1de99862971": "Reducir {label}",
apps/mobile/src/i18n/translations/fr.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Reconnectez-vous à cet environnement et réessayez. Le fichier a peut-être été déplacé ou supprimé.",
1713
"2b29584d2bcea749": "Le fichier est introuvable dans {path}.",
1714
"61026d122846876c": "Joignez à nouveau le fichier et réessayez.",
1715
+ "d0872cb98b34eae8": "Désactiver {label} pour les environnements sélectionnés",
1716
"a9129aaa7c955e46": "Activer {label} pour les environnements sélectionnés",
1717
+ "53207498f814efe0": "Mixte · Désactiver",
1718
"fd569def3acc6750": "Mixte · Activer",
1719
"8eebcd051255ba20": "Ignorer le message",
1720
"8711a1de99862971": "Diminuer {label}",
apps/mobile/src/i18n/translations/ja.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "この環境に再接続して、もう一度お試しください。ファイルが移動または削除された可能性があります。",
1713
"2b29584d2bcea749": "{path} にファイルが見つかりませんでした。",
1714
"61026d122846876c": "ファイルをもう一度添付して再試行してください。",
1715
+ "d0872cb98b34eae8": "選択した環境で {label} をオフにする",
1716
"a9129aaa7c955e46": "選択した環境で {label} をオンにする",
1717
+ "53207498f814efe0": "混在 · オフにする",
1718
"fd569def3acc6750": "混在 · オンにする",
1719
"8eebcd051255ba20": "メッセージを閉じる",
1720
"8711a1de99862971": "{label} を減らす",
apps/mobile/src/i18n/translations/ko.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "이 환경에 다시 연결한 뒤 시도하세요. 파일이 이동되었거나 삭제되었을 수 있습니다.",
1713
"2b29584d2bcea749": "{path}에서 파일을 찾을 수 없습니다.",
1714
"61026d122846876c": "파일을 다시 첨부한 뒤 다시 시도하세요.",
1715
+ "d0872cb98b34eae8": "선택한 환경에서 {label} 끄기",
1716
"a9129aaa7c955e46": "선택한 환경에서 {label} 켜기",
1717
+ "53207498f814efe0": "혼합 · 끄기",
1718
"fd569def3acc6750": "혼합 · 켜기",
1719
"8eebcd051255ba20": "메시지 닫기",
1720
"8711a1de99862971": "{label} 줄이기",
apps/mobile/src/i18n/translations/pt-BR.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Reconecte a este ambiente e tente novamente. O arquivo pode ter sido movido ou excluído.",
1713
"2b29584d2bcea749": "O arquivo não foi encontrado em {path}.",
1714
"61026d122846876c": "Anexe o arquivo novamente e tente de novo.",
1715
+ "d0872cb98b34eae8": "Desativar {label} nos ambientes selecionados",
1716
"a9129aaa7c955e46": "Ativar {label} nos ambientes selecionados",
1717
+ "53207498f814efe0": "Misto · Desativar",
1718
"fd569def3acc6750": "Misto · Ativar",
1719
"8eebcd051255ba20": "Dispensar mensagem",
1720
"8711a1de99862971": "Diminuir {label}",
apps/mobile/src/i18n/translations/ru.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Переподключитесь к этому окружению и попробуйте снова. Возможно, файл перемещён или удалён.",
1713
"2b29584d2bcea749": "Файл не найден по пути {path}.",
1714
"61026d122846876c": "Прикрепите файл снова и повторите.",
1715
+ "d0872cb98b34eae8": "Выключить {label} для выбранных окружений",
1716
"a9129aaa7c955e46": "Включить {label} для выбранных окружений",
1717
+ "53207498f814efe0": "По-разному · Выключить",
1718
"fd569def3acc6750": "По-разному · Включить",
1719
"8eebcd051255ba20": "Скрыть сообщение",
1720
"8711a1de99862971": "Уменьшить {label}",
apps/mobile/src/i18n/translations/sv.json
+2
@@ -1712,7 +1712,9 @@
1712
"0efe7ba6d7f681f1": "Återanslut till miljön och försök igen. Filen kan ha flyttats eller tagits bort.",
1713
"2b29584d2bcea749": "Filen hittades inte på {path}.",
1714
"61026d122846876c": "Bifoga filen igen och försök på nytt.",
1715
+ "d0872cb98b34eae8": "Slå av {label} för valda miljöer",
1716
"a9129aaa7c955e46": "Slå på {label} för valda miljöer",
1717
+ "53207498f814efe0": "Blandat · Slå av",
1718
"fd569def3acc6750": "Blandat · Slå på",
1719
"8eebcd051255ba20": "Stäng meddelandet",
1720
"8711a1de99862971": "Minska {label}",
apps/mobile/src/i18n/translations/zh.json
+2
@@ -1713,7 +1713,9 @@
1713
"0efe7ba6d7f681f1": "请重新连接到此环境后重试。文件可能已被移动或删除。",
1714
"2b29584d2bcea749": "在 {path} 未找到文件。",
1715
"61026d122846876c": "请重新附加文件后重试。",
1716
+ "d0872cb98b34eae8": "为所选环境关闭 {label}",
1717
"a9129aaa7c955e46": "为所选环境开启 {label}",
1718
+ "53207498f814efe0": "不一致 · 设为关闭",
1719
"fd569def3acc6750": "不一致 · 设为开启",
1720
"8eebcd051255ba20": "关闭消息",
1721
"8711a1de99862971": "减少 {label}",
apps/mobile/vite.config.ts
+1
@@ -24,6 +24,7 @@ const reactTests = [
24
"src/features/pull-requests/usePullRequestDiff.test.tsx",
25
"src/components/ProjectFavicon.test.tsx",
26
"src/components/ui/Dialog.android.test.tsx",
27
+ "src/components/ui/ListToggleRow.test.tsx",
28
"src/features/pull-requests/usePullRequestList.test.tsx",
29
"src/components/ui/AppBar.android.test.tsx",
30
"src/features/files/ZipArchiveView.test.tsx",