Skip to content

Commit 1c8d785

Browse files
committed
fix: merge main to unblock usage polling typecheck
2 parents cd82629 + 11f61a5 commit 1c8d785

46 files changed

Lines changed: 1138 additions & 584 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/ci.yml‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,7 @@ jobs:
489489
run: >-
490490
vp run test:cached -- --shard ${{ matrix.shard }}/${{ strategy.job-total }}
491491
--uncached apps/server/integration/transferBudgetV2.integration.test.ts
492-
--verify-hits 1 --report "${{ runner.temp }}/test-cache-${{ matrix.shard }}.json" apps/server
493-
494-
- name: Upload test cache measurements
495-
if: always() && steps.changes.outputs.test_server != 'false'
496-
uses: actions/upload-artifact@v7
497-
with:
498-
name: test-cache-${{ matrix.shard }}
499-
path: ${{ runner.temp }}/test-cache-${{ matrix.shard }}.json
500-
if-no-files-found: error
492+
--verify-hits 1 apps/server
501493
502494
# integration/transferBudgetV2.integration.test.ts writes the report; exactly one shard
503495
# produces these files. Gating the upload on their presence keeps a

‎apps/mobile/src/features/files/SourceFileSurface.tsx‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { LegendList, type LegendListRef } from "@legendapp/list/react-native";
12
import { settlePromise } from "@t3tools/client-runtime/state/runtime";
23
import { useAtomValue } from "@effect/atom-react";
34
import { AsyncResult } from "effect/reactivity";
45
import type { ComponentType } from "react";
56
import { useLayoutEffect, useRef, useState } from "react";
67
import {
7-
FlatList,
88
Platform,
99
Pressable,
1010
RefreshControl,
@@ -13,6 +13,7 @@ import {
1313
useWindowDimensions,
1414
View,
1515
} from "react-native";
16+
import { NativeScrollView } from "../../native/NativeScrollViewMarker";
1617
import { WebView } from "react-native-webview";
1718
import { useSafeAreaInsets } from "react-native-safe-area-context";
1819
import { AppText as Text } from "../../components/ui/AppText";
@@ -43,7 +44,6 @@ import {
4344
selectableSourceHtml,
4445
} from "./source-file-document";
4546
import { sourceHighlightAtom } from "./sourceHighlightingState";
46-
import { createSourceLineScroll } from "./source-file-scroll";
4747

4848
interface SourceFileSurfaceProps {
4949
readonly contents: string;
@@ -270,8 +270,7 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
270270
const { codeSurface, codeWordBreak } = useAppearanceCodeSurface();
271271
const { normalizedContents, lines, status, targetIndex, tokens } = useSourceFileModel(props);
272272
const selectableTokens = props.selectable ? boundedSelectableSourceTokens(tokens) : null;
273-
const listRef = useRef<FlatList<string>>(null);
274-
const [lineScroll] = useState(createSourceLineScroll);
273+
const listRef = useRef<LegendListRef>(null);
275274
const { isPullRefreshing, handlePullToRefresh } = useSourceFileRefresh(props.onRefresh);
276275
const refreshControl = props.onRefresh ? (
277276
<RefreshControl refreshing={isPullRefreshing} onRefresh={() => void handlePullToRefresh()} />
@@ -283,15 +282,21 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
283282
const usesTextSelection = props.selectable === true && !usesWebSelection;
284283

285284
// Layout effect so a pending jump is cancelled in the commit that swaps the file.
286-
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the FlatList to the target line and cancels a pending jump when the file changes
285+
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- scrolls the list to the target line and cancels a pending jump when the file changes
287286
useLayoutEffect(() => {
288287
if (targetIndex === null || !usesLineList) {
289288
return;
290289
}
291-
lineScroll.scrollToLine(listRef.current, targetIndex);
292-
return lineScroll.cancel;
290+
const frame = requestAnimationFrame(() => {
291+
void listRef.current?.scrollToIndex({
292+
index: targetIndex,
293+
animated: false,
294+
viewPosition: 0.3,
295+
});
296+
});
297+
return () => cancelAnimationFrame(frame);
293298
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening another file at the same line index, or leaving selection mode, scrolls the remounted list to it.
294-
}, [lineScroll, props.path, targetIndex, usesLineList]);
299+
}, [props.path, targetIndex, usesLineList]);
295300

296301
const { onLongPressLine } = props;
297302
const renderLine = ({ item, index }: { item: string; index: number }) => (
@@ -385,33 +390,26 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
385390
) : null;
386391

387392
const list = (
388-
<FlatList
393+
<LegendList
389394
ref={listRef}
395+
// An embedded viewer sits inside another screen's scroll surface.
396+
renderScrollComponent={props.embedded ? undefined : NativeScrollView}
390397
contentInsetAdjustmentBehavior={usesAutomaticInsets ? "automatic" : "never"}
391398
automaticallyAdjustsScrollIndicatorInsets={usesAutomaticInsets}
392399
refreshControl={refreshControl}
393400
data={lines}
394401
keyExtractor={(_line, index) => String(index)}
395-
initialNumToRender={80}
396-
maxToRenderPerBatch={80}
397-
windowSize={12}
398-
{...(codeWordBreak
399-
? {}
400-
: {
401-
getItemLayout: (_data, index) => ({
402-
length: codeSurface.rowHeight,
403-
offset: codeSurface.rowHeight * index,
404-
index,
405-
}),
406-
})}
402+
extraData={{ tokens, targetIndex, codeSurface, codeWordBreak, onLongPressLine }}
403+
estimatedItemSize={codeSurface.rowHeight}
404+
getFixedItemSize={codeWordBreak ? undefined : () => codeSurface.rowHeight}
405+
drawDistance={codeSurface.rowHeight * 40}
406+
recycleItems
407407
contentContainerStyle={{
408408
minWidth: codeWordBreak ? undefined : "100%",
409409
paddingBottom: codeSurface.rowHeight,
410410
paddingTop: 8,
411411
}}
412412
renderItem={renderLine}
413-
onScrollToIndexFailed={lineScroll.onScrollToIndexFailed}
414-
onScrollBeginDrag={lineScroll.cancel}
415413
/>
416414
);
417415

‎apps/mobile/src/features/files/source-file-scroll.test.ts‎

Lines changed: 0 additions & 156 deletions
This file was deleted.

‎apps/mobile/src/features/files/source-file-scroll.ts‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function HomeScrollView(props: ComponentProps<typeof ScrollView>) {
240240
}
241241

242242
function renderHomeScrollView(props: ScrollViewProps) {
243-
// FlatList clones this with cells and ref; keep the marker inside their actual ScrollView.
243+
// The list passes its content and ref in these props; keep the marker inside the real ScrollView.
244244
return <HomeScrollView {...props} />;
245245
}
246246

@@ -748,7 +748,13 @@ export function HomeScreen(props: HomeScreenProps) {
748748
);
749749

750750
const v2ListEmpty =
751-
hasSearchQuery && threadSearch.isPending ? undefined : hasSearchQuery ? (
751+
hasSearchQuery && threadSearch.isPending ? (
752+
<EmptyState
753+
title="Searching thread messages…"
754+
detail={`Looking for "${props.searchQuery}" in messages.`}
755+
variant={Platform.OS === "android" ? "plain" : undefined}
756+
/>
757+
) : hasSearchQuery ? (
752758
<EmptyState
753759
title="No results"
754760
detail={`No threads matching "${props.searchQuery}".`}

0 commit comments

Comments
 (0)