Skip to content

Commit 993cfc5

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-11995
2 parents 45fa0f5 + d1c4b52 commit 993cfc5

47 files changed

Lines changed: 1570 additions & 1669 deletions

Some content is hidden

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

‎.github/workflows/deploy-relay.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ on:
55
branches:
66
- main
77
# Redeploys main after a variable or secret change. Alchemy redeploys the
8-
# Worker when a value it reads changes, so force is rarely needed, and it
9-
# replaces the Postgres runtime role (alchemy-run/alchemy#1832).
8+
# Worker when a value it reads changes, so force is rarely needed.
109
workflow_dispatch:
1110
inputs:
1211
force:
13-
description: Redeploy every resource, including ones with no detected changes. Replaces the Postgres runtime role.
12+
description: Redeploy every resource, including ones with no detected changes.
1413
type: boolean
1514
default: false
1615

‎apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3WorkspaceNavigationModule.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ class T3WorkspaceNavigationView(
284284
},
285285
) {
286286
val fraction = progress.coerceIn(0f, 1f)
287+
val railShape = RoundedCornerShape(topEnd = 16.dp * fraction, bottomEnd = 16.dp * fraction)
287288
if (fraction > 0f) {
288289
Scrim(
289290
contentDescription = "Close navigation rail",
@@ -295,8 +296,8 @@ class T3WorkspaceNavigationView(
295296
Modifier
296297
.fillMaxHeight()
297298
.width(lerp(RAIL_WIDTH, EXPANDED_RAIL_WIDTH, progress.coerceAtLeast(0f)))
298-
.shadow(RAIL_SHADOW * fraction, RAIL_EXPANDED_SHAPE, clip = false)
299-
.background(Color(containerColor), RAIL_EXPANDED_SHAPE)
299+
.shadow(RAIL_SHADOW * fraction, railShape, clip = false)
300+
.background(Color(containerColor), railShape)
300301
.padding(top = safeAreaTop.dp, bottom = safeAreaBottom.dp + 12.dp)
301302
.selectableGroup(),
302303
) {
@@ -437,7 +438,6 @@ class T3WorkspaceNavigationView(
437438
val FAB_SIZE = 48.dp
438439
val ICON_SIZE = 24.dp
439440
val RAIL_SHADOW = 6.dp
440-
val RAIL_EXPANDED_SHAPE = RoundedCornerShape(topEnd = 16.dp, bottomEnd = 16.dp)
441441
const val DISABLED_ALPHA = 0.4f
442442

443443
// Labels fade in over the second half of the widening, once there is room for them, and
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import type { ReactNode } from "react";
2+
import { act, Profiler } from "react";
3+
import { createRoot } from "react-dom/client";
4+
import { expect, it, vi } from "vite-plus/test";
5+
6+
const harness = vi.hoisted(() => ({
7+
Passthrough: ({ children }: { children?: unknown }) => children,
8+
}));
9+
10+
vi.mock("react-native", () => ({ View: harness.Passthrough }));
11+
vi.mock("expo-image", () => ({ Image: () => <img alt="" /> }));
12+
vi.mock("./ui/AppSymbol", () => ({ SymbolView: () => null }));
13+
vi.mock("./ui/AppText", () => ({
14+
AppText: ({ children }: { children?: ReactNode }) => <span>{children}</span>,
15+
}));
16+
vi.mock("../state/assets", async () => {
17+
const { Atom } = await import("effect/reactivity");
18+
const url = Atom.make<string | null>("https://example.test/favicon.png");
19+
return { projectFaviconUrlAtom: () => url };
20+
});
21+
22+
import { EnvironmentId } from "@t3tools/contracts";
23+
24+
import { ProjectFavicon } from "./ProjectFavicon";
25+
26+
it("mounts the favicon image in the first commit", async () => {
27+
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
28+
const container = document.createElement("div");
29+
const root = createRoot(container);
30+
const commits: string[] = [];
31+
try {
32+
await act(async () =>
33+
root.render(
34+
<Profiler id="favicon" onRender={(_id, phase) => commits.push(phase)}>
35+
<ProjectFavicon
36+
environmentId={EnvironmentId.make("env-1")}
37+
projectTitle="Project"
38+
workspaceRoot="/repo"
39+
/>
40+
</Profiler>,
41+
),
42+
);
43+
expect(container.querySelector("img")).not.toBeNull();
44+
expect(commits).toEqual(["mount"]);
45+
} finally {
46+
await act(async () => root.unmount());
47+
}
48+
});

‎apps/mobile/src/components/ProjectFavicon.tsx‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,11 @@ function ProjectFaviconImage(props: {
163163
() => createProjectFaviconRequest(props.cacheKey, props.faviconUrl),
164164
[props.cacheKey, props.faviconUrl],
165165
);
166-
const [activeFaviconRequest, setActiveFaviconRequest] = useState<typeof faviconRequest>(null);
166+
// Registers with the module-level loader before the Image's native onLoad/onError can fire,
167+
// so stale loads for a superseded URL under the same cacheKey are ignored.
167168
useLayoutEffect(() => {
168169
if (faviconRequest === null) return;
169-
170-
const endRequest = beginProjectFaviconRequest(faviconRequest);
171-
// oxlint-disable-next-line react/set-state-in-effect -- Publishes the favicon request registered with the external loader until its cleanup runs.
172-
setActiveFaviconRequest(faviconRequest);
173-
return endRequest;
170+
return beginProjectFaviconRequest(faviconRequest);
174171
}, [faviconRequest]);
175172

176173
const [status, setStatus] = useState<"loading" | "loaded" | "error">(() =>
@@ -179,8 +176,7 @@ function ProjectFaviconImage(props: {
179176
: "loading",
180177
);
181178

182-
const requestIsActive = faviconRequest !== null && activeFaviconRequest === faviconRequest;
183-
const showImage = requestIsActive && status === "loaded";
179+
const showImage = faviconRequest !== null && status === "loaded";
184180
const fallbackGlyph = showImage ? null : projectAutoMonogram(props.projectTitle);
185181

186182
return (
@@ -203,7 +199,7 @@ function ProjectFaviconImage(props: {
203199
/>
204200
)}
205201

206-
{requestIsActive ? (
202+
{faviconRequest !== null ? (
207203
<Image
208204
key={faviconRequest.faviconUrl}
209205
source={

‎apps/mobile/src/features/home/HomeRouteScreen.tsx‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
66
import * as Arr from "effect/Array";
77
import * as Order from "effect/Order";
88
import { useNavigation } from "@react-navigation/native";
9-
import { useCallback, useEffect, useMemo, useState } from "react";
9+
import { useCallback, useMemo, useState } from "react";
1010
import { Platform, useWindowDimensions } from "react-native";
1111

1212
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
@@ -137,16 +137,16 @@ export function HomeRouteScreen() {
137137
setSelectedProjectKey,
138138
} = useHomeListOptions(availableEnvironmentIds);
139139
const selectedEnvironmentId = listOptions.selectedEnvironmentId;
140-
const projectScopeKey = listOptions.selectedProjectKey;
141-
const resolvedProjectKey = resolveScratchProjectScopeKey(projectScopeKey, projects, {
142-
sidebarProjectGroupingMode: listOptions.projectGroupingMode,
143-
sidebarProjectGroupingOverrides: {},
144-
});
145-
useEffect(() => {
146-
if (resolvedProjectKey !== projectScopeKey) {
147-
setSelectedProjectKey(resolvedProjectKey);
148-
}
149-
}, [projectScopeKey, resolvedProjectKey, setSelectedProjectKey]);
140+
// A legacy per-environment scratch key resolves here on every render; the stored
141+
// value is only rewritten when the user picks a filter.
142+
const resolvedProjectKey = resolveScratchProjectScopeKey(
143+
listOptions.selectedProjectKey,
144+
projects,
145+
{
146+
sidebarProjectGroupingMode: listOptions.projectGroupingMode,
147+
sidebarProjectGroupingOverrides: {},
148+
},
149+
);
150150
const projectFilterOptions = useMemo(
151151
() =>
152152
buildHomeProjectScopes({

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { AnimatedLegendList } from "@legendapp/list/reanimated";
1515
import { THREAD_SIDEBAR_ROW_LAYOUT } from "./threadListAnimations";
1616
import type { MenuAction } from "@react-native-menu/menu";
1717
import { useAtomValue } from "@effect/atom-react";
18-
import { useEffect, useMemo, useRef, useState } from "react";
18+
import { useMemo, useRef, useState } from "react";
1919
import type { LayoutChangeEvent, TextInputInstance } from "react-native";
2020
import { Platform, StyleSheet, TextInput, View } from "react-native";
2121
import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
@@ -198,16 +198,12 @@ function ThreadNavigationSidebarPane(
198198
)
199199
? [options.selectedEnvironmentId]
200200
: [];
201-
const projectScopeKey = options.selectedProjectKey;
202-
const resolvedProjectKey = resolveScratchProjectScopeKey(projectScopeKey, projects, {
201+
// A legacy per-environment scratch key resolves here on every render; the stored
202+
// value is only rewritten when the user picks a filter.
203+
const resolvedProjectKey = resolveScratchProjectScopeKey(options.selectedProjectKey, projects, {
203204
sidebarProjectGroupingMode: options.projectGroupingMode,
204205
sidebarProjectGroupingOverrides: {},
205206
});
206-
useEffect(() => {
207-
if (resolvedProjectKey !== projectScopeKey) {
208-
setSelectedProjectKey(resolvedProjectKey);
209-
}
210-
}, [projectScopeKey, resolvedProjectKey, setSelectedProjectKey]);
211207
const projectScopes = useMemo(
212208
() =>
213209
buildHomeProjectScopes({

0 commit comments

Comments
 (0)