GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(client-runtime): merge main and preserve the slow-host session ta… · pingdotgg/t3code@8fbfc33

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps
    • mobile/src
      • Stack.tsx
      • components
        • ComposerAttachmentStrip.tsx
        • ComposerContextAttachment.tsx
        • FilePreviewModal.tsx
        • PdfPreview.android.tsx
        • VideoPreviewModal.ios.tsx
        • VideoPreviewModal.tsx
        • VideoThumbnailImage.tsx
      • features
        • diffs
          • nativeReviewDiffSurface.test.tsx
        • files
          • AttachmentFileScreen.tsx
        • pull-requests
          • PullRequestFiles.tsx
          • PullRequestRouteScreen.tsx
          • guide
            • PullRequestGuideScreen.tsx
          • pullRequestDiffDebug.test.ts
          • pullRequestDiffDebug.ts
          • pullRequestFileJump.test.ts
          • pullRequestFileJump.ts
        • threads
          • GitActionProgressOverlay.tsx
          • NewTaskDraftScreen.tsx
          • PendingUserInputCard.tsx
          • QuestionAttachments.tsx
          • ThreadComposer.tsx
          • ThreadDetailScreen.tsx
          • ThreadQueueControl.tsx
          • ThreadRouteScreen.tsx
          • ThreadSettingsSheet.tsx
          • pending-thread-feed.test.ts
          • pending-thread-feed.ts
          • use-thread-settings-sheet-presentation.ts
        • voice-input
          • ComposerDictationControl.tsx
      • lib
        • attachmentDocument.ts
        • composerImagePreview.test.ts
        • composerImagePreview.ts
        • localAttachmentPreview.test.ts
        • localAttachmentPreview.ts
        • previewPresentation.ts
        • useMediaVideoPlayback.test.tsx
      • native
        • T3ComposerEditor.ios.tsx
        • T3ComposerEditor.native.tsx
      • reactCompilerCoverage.test.ts
      • state
        • acknowledged-thread-messages.ts
        • assets.ts
        • queued-run-edit.test.ts
        • queued-run-edit.ts
        • thread-provider-switching.ts
        • use-thread-composer-state.ts
        • use-thread-detail.ts
        • use-thread-outbox-drain.permissions.test.ts
        • use-thread-outbox-drain.test.ts
    • server/src/pullRequest
      • PullRequestReadCache.test.ts
      • PullRequestReadCache.ts
    • web/src
      • AppRoot.tsx
      • appInit.tsx
      • browserFaviconStore.test.ts
      • browserFaviconStore.ts
      • browserHistoryStore.test.ts
      • browserHistoryStore.ts
      • browser
        • BrowserProfileReporter.test.ts
        • BrowserProfileReporter.tsx
        • BrowserProfileReporter.ts
        • HostedBrowserWebview.tsx
        • ServerBrowserSurface.tsx
        • browserViewportActions.test.ts
        • browserViewportActions.ts
        • useBrowserViewportResize.ts
      • components
        • ChatMarkdown.browser.test.tsx
        • ChatMarkdown.tsx
        • ComposerPromptEditorTiptap.tsx
        • KeybindingsUpdateToast.test.ts
        • KeybindingsUpdateToast.tsx
        • ReopenClosedViewShortcut.browser.test.tsx
        • SlowRpcRequestToastCoordinator.tsx
        • chat
          • MessagesTimeline.tsx
          • SkillInlineText.tsx
          • TimelineUserMessageRow.tsx
          • UserMessageContextChips.tsx
          • timelineRowContext.ts
        • contextChipParts.tsx
        • files
          • AttachmentFilePreview.browser.test.tsx
        • preview
          • PreviewChromeRow.tsx
          • PreviewView.browser.test.tsx
          • PreviewView.tsx
        • pullRequest
          • LinkPullRequestDialog.browser.test.tsx
          • LinkPullRequestDialog.tsx
          • PullRequestCommentBody.tsx
          • PullRequestsPage.tsx
          • useInlineActionConfirm.browser.test.tsx
          • useInlineActionConfirm.ts
        • settings
          • AcpRegistryIcon.tsx
          • AcpRegistrySearchStep.browser.test.tsx
          • AcpRegistrySearchStep.tsx
          • AddProviderInstanceDialog.tsx
          • CliCommandSettingsRow.tsx
          • CodexSetupSection.logic.test.ts
          • CodexSetupSection.logic.ts
          • CodexSetupSection.tsx
          • ProviderAccentColorPicker.tsx
          • ProviderInstanceCard.tsx
          • ProviderSettingsForm.test.ts
          • ProviderSettingsForm.tsx
          • colorPickers.browser.test.tsx
      • hooks
        • useEnvironmentTheme.test.ts
        • useEnvironmentTheme.ts
        • useHandleNewThread.test.ts
        • useHandleNewThread.ts
        • useScratchProject.ts
        • useSettings.ts
        • useStableCallback.browser.test.tsx
        • useTheme.ts
      • routes
        • __root.tsx
        • _chat.tsx
      • rpc
        • atomRegistry.ts
        • requestLatencyState.ts
      • shortcuts
        • chatRouteCommands.browser.test.ts
        • chatRouteCommands.ts
      • state
        • desktopCliCommand.test.ts
        • desktopCliCommand.ts
        • entities.ts
        • environments.ts
        • previewStream.ts
        • waitForQuerySettled.test.ts
        • waitForQuerySettled.ts
      • themePalette.ts
  • packages
    • client-runtime/src
      • queuedRunEdit.test.ts
      • queuedRunEdit.ts
      • state
        • environmentHttpAuth.test.ts
        • session.ts
    • shared/src
      • inlineSkills.ts
      • relayClient.ts

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/mobile/src/Stack.tsx‎

Copy file name to clipboardExpand all lines: apps/mobile/src/Stack.tsx
+12-15Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ import {
8282
NewTaskEnvironmentPickerRouteScreen,
8383
} from "./features/threads/NewTaskContextPickerScreens";
8484
import {
85-
ExistingThreadSettingsRouteProvider,
8685
ExistingThreadSettingsRouteScreen,
8786
NewTaskThreadSettingsRouteScreen,
8887
} from "./features/threads/ThreadSettingsSheet";
@@ -550,20 +549,18 @@ function RootStackLayout(props: {
550549
<ThreadOutboxDrainWorker />
551550
<ShowcaseCaptureCoordinator pathname={pathname} />
552551
<SettingsEnvironmentFilterProvider open={settingsOpen}>
553-
<ExistingThreadSettingsRouteProvider>
554-
<WorkspaceConnectionStatusProvider>
555-
<AndroidWorkspaceTabsProvider state={props.state}>
556-
<AdaptiveWorkspaceLayout
557-
pathname={workspaceLocation.pathname}
558-
workspaceRouteKey={workspaceLocation.routeKey}
559-
selectedPullRequestKey={selectedPullRequestKey(props.state)}
560-
>
561-
{props.children}
562-
<HardwareKeyboardCommandOverlay />
563-
</AdaptiveWorkspaceLayout>
564-
</AndroidWorkspaceTabsProvider>
565-
</WorkspaceConnectionStatusProvider>
566-
</ExistingThreadSettingsRouteProvider>
552+
<WorkspaceConnectionStatusProvider>
553+
<AndroidWorkspaceTabsProvider state={props.state}>
554+
<AdaptiveWorkspaceLayout
555+
pathname={workspaceLocation.pathname}
556+
workspaceRouteKey={workspaceLocation.routeKey}
557+
selectedPullRequestKey={selectedPullRequestKey(props.state)}
558+
>
559+
{props.children}
560+
<HardwareKeyboardCommandOverlay />
561+
</AdaptiveWorkspaceLayout>
562+
</AndroidWorkspaceTabsProvider>
563+
</WorkspaceConnectionStatusProvider>
567564
</SettingsEnvironmentFilterProvider>
568565
</HardwareKeyboardCommandProvider>
569566
</NewTaskFlowProvider>
Collapse file

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

Copy file name to clipboardExpand all lines: apps/mobile/src/components/ComposerAttachmentStrip.tsx
+28-62Lines changed: 28 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import { composerImageGallery } from "../lib/composerImageGallery";
33
import { SymbolView } from "./ui/AppSymbol";
44
import { imageMimeType } from "@t3tools/shared/image";
55
import { videoMimeType } from "@t3tools/shared/video";
6-
import { useEffect, useMemo, useState } from "react";
6+
import { useAtomValue } from "@effect/atom-react";
7+
import { AsyncResult, Atom } from "effect/reactivity";
8+
import { Paths } from "expo-file-system";
79
import { Image, Pressable, ScrollView, View } from "react-native";
810

911
import { AppText as Text } from "./ui/AppText";
12+
import { MaterializedPreviewKey, materializedPreviewAtom } from "../lib/composerImagePreview";
1013
import { PierreEntryIcon } from "./PierreEntryIcon";
1114
import {
1215
isFileBackedComposerAttachment,
@@ -93,65 +96,31 @@ export function ComposerAttachmentThumbnail(props: ComposerAttachmentThumbnailPr
9396
);
9497
}
9598

96-
const PREVIEW_CACHE_DIRECTORY = "t3-composer-previews";
97-
9899
/** Fabric re-parses URLs each layout; large data URLs can stall and abort commits. */
99100
const INLINE_PREVIEW_FALLBACK_MAX_CHARS = 256_000;
100101

101-
async function materializeDataUrlPreview(id: string, dataUrl: string): Promise<string | null> {
102-
const comma = dataUrl.indexOf(",");
103-
if (comma < 0) return null;
104-
const { Directory, File, Paths } = await import("expo-file-system");
105-
const mimeType = /^data:([^;,]+)/.exec(dataUrl)?.[1] ?? "image/jpeg";
106-
const extension = (mimeType.split("/")[1] ?? "jpg").replace("jpeg", "jpg");
107-
const directory = new Directory(Paths.cache, PREVIEW_CACHE_DIRECTORY);
108-
directory.create({ idempotent: true, intermediates: true });
109-
const file = new File(directory, `${id}.${extension}`);
110-
if (!file.exists) {
111-
file.create();
112-
await file.write(dataUrl.slice(comma + 1), { encoding: "base64" });
113-
}
114-
return file.uri;
115-
}
102+
const noMaterializedPreview = Atom.make(AsyncResult.initial<string | null>()).pipe(
103+
Atom.withLabel("composer-image-preview:none"),
104+
);
116105

117106
function useComposerImagePreviewUri(attachment: DraftComposerImageAttachment): string | null {
118-
const { id, fileUri, previewUri } = attachment;
119-
const [rebased, setRebased] = useState<{ fileUri: string; uri: string } | null>(null);
120-
const [materialized, setMaterialized] = useState<{ id: string; uri: string | null } | null>(null);
107+
const { fileUri, previewUri } = attachment;
121108
const inlinePreview = fileUri === undefined && previewUri.startsWith("data:");
122-
useEffect(() => {
123-
if (fileUri === undefined) return;
124-
let cancelled = false;
125-
void (async () => {
126-
const { Paths } = await import("expo-file-system");
127-
const owned = resolveOwnedComposerAttachmentFileUri(fileUri, Paths.document.uri);
128-
if (!cancelled && owned !== null && owned !== previewUri) setRebased({ fileUri, uri: owned });
129-
})();
130-
return () => {
131-
cancelled = true;
132-
};
133-
}, [fileUri, previewUri]);
134-
useEffect(() => {
135-
if (!inlinePreview) return;
136-
let cancelled = false;
137-
void materializeDataUrlPreview(id, previewUri)
138-
.then((uri) => {
139-
if (!cancelled && uri !== null) setMaterialized({ id, uri });
140-
})
141-
.catch((error: unknown) => {
142-
console.warn("[composer-attachments] could not cache an image preview", error);
143-
if (!cancelled) setMaterialized({ id, uri: null });
144-
});
145-
return () => {
146-
cancelled = true;
147-
};
148-
}, [id, inlinePreview, previewUri]);
149-
if (fileUri !== undefined && rebased?.fileUri === fileUri) return rebased.uri;
150-
if (fileUri !== undefined) return previewUri.startsWith("data:") ? fileUri : previewUri;
109+
const materialized = useAtomValue(
110+
inlinePreview
111+
? materializedPreviewAtom(new MaterializedPreviewKey(attachment))
112+
: noMaterializedPreview,
113+
);
114+
if (fileUri !== undefined) {
115+
// Reinstalls move the app container, so a stored file URI may point at the old one.
116+
const owned = resolveOwnedComposerAttachmentFileUri(fileUri, Paths.document.uri);
117+
if (owned !== null) return owned;
118+
return previewUri.startsWith("data:") ? fileUri : previewUri;
119+
}
151120
if (inlinePreview) {
152-
if (materialized?.id !== id) return null;
121+
if (!AsyncResult.isSuccess(materialized)) return null;
153122
return (
154-
materialized.uri ??
123+
materialized.value ??
155124
(previewUri.length <= INLINE_PREVIEW_FALLBACK_MAX_CHARS ? previewUri : null)
156125
);
157126
}
@@ -280,15 +249,12 @@ function ComposerVideoAttachment(props: {
280249
const { attachment } = props;
281250
const sourceIdentifier = `draft:${attachment.id}`;
282251
const style = { width: props.size, height: props.size, borderRadius: props.borderRadius };
283-
const actionsSource = useMemo<MediaActionsSource>(
284-
() => ({
285-
name: attachment.name,
286-
mimeType: videoMimeType(attachment) ?? attachment.mimeType,
287-
sourceIdentifier,
288-
attachment,
289-
}),
290-
[attachment, sourceIdentifier],
291-
);
252+
const actionsSource: MediaActionsSource = {
253+
name: attachment.name,
254+
mimeType: videoMimeType(attachment) ?? attachment.mimeType,
255+
sourceIdentifier,
256+
attachment,
257+
};
292258

293259
return (
294260
<VideoAttachmentTile
@@ -304,7 +270,7 @@ function ComposerVideoAttachment(props: {
304270
}
305271

306272
export function ComposerAttachmentStrip(props: ComposerAttachmentStripProps) {
307-
const gallery = useMemo(() => composerImageGallery(props.attachments), [props.attachments]);
273+
const gallery = composerImageGallery(props.attachments);
308274
const size = props.imageSize ?? 72;
309275
const radius = props.imageBorderRadius ?? 16;
310276
const removeButtonPlacement = props.removeButtonPlacement ?? "overlay";
Collapse file

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

Copy file name to clipboardExpand all lines: apps/mobile/src/components/ComposerContextAttachment.tsx
+10-25Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import * as Dialog from "./ui/Dialog";
55
import type { ComposerContextRecord, EnvironmentId } from "@t3tools/contracts";
66
import { Pressable, View } from "react-native";
77
import { Image } from "expo-image";
8-
import { useEffect, useId, useState } from "react";
8+
import { useId, useState } from "react";
99
import type { DraftComposerAttachment } from "../lib/composerImages";
1010
import { composerAttachmentInlineUri, isFileBackedComposerAttachment } from "../lib/composerImages";
11-
import { loadLocalAttachmentPreview } from "../lib/localAttachmentPreview";
11+
import {
12+
loadLocalAttachmentPreview,
13+
useLocalAttachmentPreview,
14+
} from "../lib/localAttachmentPreview";
1215
import { downloadAndShareAttachment } from "../lib/attachmentDownload";
1316
import { assetImageSource } from "../lib/assetImageSource";
1417
import { useAssetUrlState, useRefreshAssetUrl } from "../state/assets";
@@ -35,31 +38,13 @@ export function ComposerContextAttachment(props: {
3538
const remoteEnvironmentId = local || inlineUri ? null : (props.environmentId ?? null);
3639
const asset = useAssetUrlState(remoteEnvironmentId, resource);
3740
const refresh = useRefreshAssetUrl(remoteEnvironmentId, resource);
38-
const [localUri, setLocalUri] = useState<string | null>(null);
39-
const [error, setError] = useState<string | null>(null);
41+
const localPreview = useLocalAttachmentPreview(local ?? null);
42+
const error = localPreview.error ? "The local file is unavailable. Attach it again." : null;
4043
const [sharing, setSharing] = useState(false);
4144
const [previewOpen, setPreviewOpen] = useState(false);
42-
useEffect(() => {
43-
if (!local) return;
44-
const controller = new AbortController();
45-
let dispose: (() => void) | undefined;
46-
void loadLocalAttachmentPreview(local, controller.signal)
47-
.then((preview) => {
48-
if (!preview) return;
49-
if (controller.signal.aborted) return preview.dispose();
50-
dispose = preview.dispose;
51-
setLocalUri(preview.uri);
52-
setError(null);
53-
})
54-
.catch(() => {
55-
if (!controller.signal.aborted) setError("The local file is unavailable. Attach it again.");
56-
});
57-
return () => {
58-
controller.abort();
59-
dispose?.();
60-
};
61-
}, [local]);
62-
const uri = local ? localUri : (inlineUri ?? (asset._tag === "Success" ? asset.url : null));
45+
const uri = local
46+
? localPreview.uri
47+
: (inlineUri ?? (asset._tag === "Success" ? asset.url : null));
6348
const share = async () => {
6449
if (sharing) return;
6550
setSharing(true);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.