GeezerVison is showing github.com — chore(deps): web and mobile share React 19.3 from the catalog (#21376) · pingdotgg/t3code@15903f1
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/mobile/package.json +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 119 | 119 | "expo-video": "~58.0.11", | 120 | 120 | "expo-web-browser": "~58.0.6", | 121 | 121 | "expo-widgets": "58.0.20", | 122 | | - "react": "19.3.0", | 123 | | - "react-dom": "19.3.0", | | 122 | + "react": "catalog:", | | 123 | + "react-dom": "catalog:", | 124 | 124 | "react-native": "0.88.0", | 125 | 125 | "react-native-enriched-markdown": "file:deps/react-native-enriched-markdown-1.2.0-t3.15.tgz", | 126 | 126 | "react-native-gesture-handler": "~3.3.0", | | 146 | 146 | "@effect/vitest": "catalog:", | 147 | 147 | "@pierre/trees": "1.0.0-beta.6", | 148 | 148 | "@types/mdast": "^4.0.4", | 149 | | - "@types/react": "~19.3.0", | 150 | | - "@types/react-dom": "~19.2.3", | | 149 | + "@types/react": "catalog:", | | 150 | + "@types/react-dom": "catalog:", | 151 | 151 | "babel-preset-expo": "~58.0.17", | 152 | 152 | "jsdom": "^30.0.1", | 153 | 153 | "tailwindcss": "^4.0.0", | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/package.json +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 65 | 65 | "lucide-react": "^0.564.0", | 66 | 66 | "mermaid": "^11.17.2", | 67 | 67 | "morphicons": "^1.7.1", | 68 | | - "react": "19.2.6", | 69 | | - "react-dom": "19.2.6", | | 68 | + "react": "catalog:", | | 69 | + "react-dom": "catalog:", | 70 | 70 | "react-markdown": "^10.1.0", | 71 | 71 | "remark-gfm": "catalog:", | 72 | 72 | "tailwind-merge": "^3.4.0", | | 82 | 82 | "@types/compression": "^1.8.1", | 83 | 83 | "@types/culori": "^4.0.1", | 84 | 84 | "@types/mdast": "^4.0.4", | 85 | | - "@types/react": "~19.3.0", | 86 | | - "@types/react-dom": "~19.2.3", | | 85 | + "@types/react": "catalog:", | | 86 | + "@types/react-dom": "catalog:", | 87 | 87 | "@types/use-sync-external-store": "^0.0.6", | 88 | 88 | "@vercel/config": "^0.3.0", | 89 | 89 | "@vitejs/plugin-react": "^6.1.2", | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/GitActionsControl.tsx +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1199,8 +1199,8 @@ export default function GitActionsControl({ | 1199 | 1199 | }; | 1200 | 1200 | }, [activeEnvironmentId, gitCwd, refreshVcsStatus]); | 1201 | 1201 |
| 1202 | | - // React 19.2 leaves useEffectEvent stale inside the memoized details panel. | 1203 | | - // Bind each render's actions to its checkout and thread, including retained toast actions. | | 1202 | + // Not an effect event: retained toast actions must stay bound to the checkout and | | 1203 | + // thread of the render that created them, not follow later selections. | 1204 | 1204 | async function runGitActionWithToast({ | 1205 | 1205 | action, | 1206 | 1206 | commitMessage, | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/ChatComposer.tsx +2-5Lines changed: 2 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5803,11 +5803,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) | 5803 | 5803 | }, | 5804 | 5804 | }); | 5805 | 5805 |
| 5806 | | - // Stable callbacks, not useEffectEvent: ChatComposer is memoized, and React | 5807 | | - // 19.2 never refreshes an effect event's impl on memo fibers — stale closures | 5808 | | - // here would import the dropped thread into the first mounted thread's draft. | 5809 | | - const attachDroppedThreadFile = useStableCallback((file: File) => addComposerAttachments([file])); | 5810 | | - const importDroppedThread = useStableCallback( | | 5806 | + const attachDroppedThreadFile = useEffectEvent((file: File) => addComposerAttachments([file])); | | 5807 | + const importDroppedThread = useEffectEvent( | 5811 | 5808 | async (ref: ScopedThreadRef, isActive: () => boolean) => { | 5812 | 5809 | const targetKey = attachmentTargetKey; | 5813 | 5810 | pendingDraftWork.begin(targetKey); | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/threadContextDrag.browser.test.tsx +35Lines changed: 35 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,6 +40,20 @@ const ComposerDropTarget = memo(function ComposerDropTarget({ | 40 | 40 | return <div data-drop-target ref={targetRef} />; | 41 | 41 | }); | 42 | 42 |
| | 43 | +// Same target key, so the listener effect never re-runs: only the effect event | | 44 | +// itself can hand the drop the latest props (React 19.2 kept the first render's). | | 45 | +const StableKeyDropTarget = memo(function StableKeyDropTarget({ | | 46 | + received, | | 47 | +}: { | | 48 | + received: Array<ThreadId>; | | 49 | +}) { | | 50 | + const targetRef = useRef<HTMLDivElement | null>(null); | | 51 | + useThreadContextDrop(targetRef, ENVIRONMENT_ID, "thread-a", (refs) => { | | 52 | + received.push(...refs.map((ref) => ref.threadId)); | | 53 | + }); | | 54 | + return <div data-drop-target ref={targetRef} />; | | 55 | +}); | | 56 | + | 43 | 57 | describe("useThreadContextDrop", () => { | 44 | 58 | it("drops into the last rendered thread's draft when the memoized target is reused", async () => { | 45 | 59 | const drafts = new Map<string, Array<ThreadId>>([ | @@ -63,4 +77,25 @@ describe("useThreadContextDrop", () => { | 63 | 77 | expect(drafts.get("thread-b")).toEqual(["thread-dropped"]); | 64 | 78 | expect(drafts.get("thread-a")).toEqual([]); | 65 | 79 | }); | | 80 | + | | 81 | + it("reads the latest props in a memoized target whose listener stays attached", async () => { | | 82 | + const first: Array<ThreadId> = []; | | 83 | + const latest: Array<ThreadId> = []; | | 84 | + | | 85 | + await act(() => root.render(<StableKeyDropTarget received={first} />)); | | 86 | + await act(() => root.render(<StableKeyDropTarget received={latest} />)); | | 87 | + | | 88 | + const target = container.querySelector("[data-drop-target]"); | | 89 | + expect(target).not.toBeNull(); | | 90 | + act(() => { | | 91 | + target!.dispatchEvent( | | 92 | + new CustomEvent(THREAD_CONTEXT_DROP_EVENT, { | | 93 | + detail: [{ environmentId: ENVIRONMENT_ID, threadId: "thread-dropped" as ThreadId }], | | 94 | + }), | | 95 | + ); | | 96 | + }); | | 97 | + | | 98 | + expect(latest).toEqual(["thread-dropped"]); | | 99 | + expect(first).toEqual([]); | | 100 | + }); | 66 | 101 | }); |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/threadContextDrag.ts +2-8Lines changed: 2 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import type { EnvironmentId, ScopedThreadRef } from "@t3tools/contracts"; | 2 | | -import { type RefObject, useEffect, useSyncExternalStore } from "react"; | 3 | | - | 4 | | -import { useStableCallback } from "../../hooks/useStableCallback"; | | 2 | +import { type RefObject, useEffect, useEffectEvent, useSyncExternalStore } from "react"; | 5 | 3 |
| 6 | 4 | export const THREAD_CONTEXT_DROP_EVENT = "t3-thread-context-drop"; | 7 | 5 |
| @@ -11,10 +9,7 @@ export function useThreadContextDrop( | 11 | 9 | targetKey: string, | 12 | 10 | onDrop: (refs: ReadonlyArray<ScopedThreadRef>, isActive: () => boolean) => void, | 13 | 11 | ) { | 14 | | - // useStableCallback, not useEffectEvent: callers are memoized (ChatComposer), | 15 | | - // and React 19.2 never refreshes an effect event's impl on memo fibers, which | 16 | | - // would leave this drop writing into the first mounted thread's draft. | 17 | | - const handleDrop = useStableCallback(onDrop); | | 12 | + const handleDrop = useEffectEvent(onDrop); | 18 | 13 | useEffect(() => { | 19 | 14 | const target = targetRef.current; | 20 | 15 | if (!target) return; | @@ -31,7 +26,6 @@ export function useThreadContextDrop( | 31 | 26 | environmentId, | 32 | 27 | targetKey, | 33 | 28 | targetRef, | 34 | | - handleDrop, | 35 | 29 | ]); | 36 | 30 | } | 37 | 31 |
| |
|