Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(web): let the React Compiler compile usePendingThreadRequests #20294

Mergedjuliusmarmingemerged 1 commit intochatview-split/compiler-ratchet fromrefs/pull/20294/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 61 additions and 97 deletions.

x
0 of 2 viewed, 2 left
60 additions and 97 deletionsapps/web/src/components/chat/usePendingThreadRequests.tsModified
View file
@@ -16,7 +16,7 @@
isAtomCommandInterrupted,
squashAtomCommandFailure,
} from "@t3tools/client-runtime/state/runtime";
-import { useEffect, useMemo, useRef, useState, type RefObject, type SetStateAction } from "react";
+import { useEffect, useRef, useState, type RefObject, type SetStateAction } from "react";
import { useShallow } from "zustand/react/shallow";
import { DraftId, useComposerDraftStore } from "../../composerDraftStore";
import { useStableCallback } from "../../hooks/useStableCallback";
@@ -53,7 +53,7 @@
function makePendingCustomAnswerSetter(input: {
readonly activePendingUserInput: PendingUserInput | null;
readonly activePendingRequestKey: string;
- readonly promptRef: { current: string };
+ readonly writePrompt: (prompt: string) => void;
readonly setPendingUserInputAnswersByRequestId: (
update: SetStateAction<Record<string, Record<string, PendingUserInputDraftAnswer>>>,
) => void;
@@ -67,7 +67,7 @@
if (!question || question.allowCustomAnswer === false) {
return;
- input.promptRef.current = value;
+ input.writePrompt(value);
input.setPendingUserInputAnswersByRequestId((existing) => ({
...existing,
[activePendingRequestKey]: {