fix: convert from use-query-params to nuqs
This commit is contained in:
@@ -4,7 +4,7 @@ import { InboxItemInput } from "./inbox-item-input";
|
||||
import useInterruptedActions from "../hooks/use-interrupted-actions";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { toast } from "sonner";
|
||||
import { StringParam, useQueryParam } from "use-query-params";
|
||||
import { useQueryState } from 'nuqs'
|
||||
import { constructOpenInStudioURL } from "../utils";
|
||||
import { HumanInterrupt } from "@langchain/langgraph/prebuilt";
|
||||
|
||||
@@ -60,7 +60,7 @@ export function ThreadActionsView({
|
||||
showDescription,
|
||||
showState,
|
||||
}: ThreadActionsViewProps) {
|
||||
const [threadId] = useQueryParam("threadId", StringParam);
|
||||
const [threadId] = useQueryState("threadId");
|
||||
const {
|
||||
acceptAllowed,
|
||||
hasEdited,
|
||||
@@ -81,7 +81,7 @@ export function ThreadActionsView({
|
||||
} = useInterruptedActions({
|
||||
interrupt,
|
||||
});
|
||||
const [apiUrl] = useQueryParam("apiUrl", StringParam);
|
||||
const [apiUrl] = useQueryState("apiUrl");
|
||||
|
||||
const handleOpenInStudio = () => {
|
||||
if (!apiUrl) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Thread } from "@langchain/langgraph-sdk";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { getContentString } from "../utils";
|
||||
import { useQueryParam, StringParam, BooleanParam } from "use-query-params";
|
||||
import { useQueryState, parseAsBoolean } from 'nuqs'
|
||||
import {
|
||||
Sheet,
|
||||
SheetContent,
|
||||
@@ -22,7 +22,7 @@ function ThreadList({
|
||||
threads: Thread[];
|
||||
onThreadClick?: (threadId: string) => void;
|
||||
}) {
|
||||
const [threadId, setThreadId] = useQueryParam("threadId", StringParam);
|
||||
const [threadId, setThreadId] = useQueryState("threadId");
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col w-full gap-2 items-start justify-start overflow-y-scroll [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent">
|
||||
@@ -71,9 +71,9 @@ function ThreadHistoryLoading() {
|
||||
|
||||
export default function ThreadHistory() {
|
||||
const isLargeScreen = useMediaQuery("(min-width: 1024px)");
|
||||
const [chatHistoryOpen, setChatHistoryOpen] = useQueryParam(
|
||||
const [chatHistoryOpen, setChatHistoryOpen] = useQueryState(
|
||||
"chatHistoryOpen",
|
||||
BooleanParam,
|
||||
parseAsBoolean.withDefault(false),
|
||||
);
|
||||
|
||||
const { getThreads, threads, setThreads, threadsLoading, setThreadsLoading } =
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
PanelRightClose,
|
||||
SquarePen,
|
||||
} from "lucide-react";
|
||||
import { BooleanParam, StringParam, useQueryParam } from "use-query-params";
|
||||
import { useQueryState, parseAsBoolean } from 'nuqs'
|
||||
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
|
||||
import ThreadHistory from "./history";
|
||||
import { toast } from "sonner";
|
||||
@@ -68,14 +68,14 @@ function ScrollToBottom(props: { className?: string }) {
|
||||
}
|
||||
|
||||
export function Thread() {
|
||||
const [threadId, setThreadId] = useQueryParam("threadId", StringParam);
|
||||
const [chatHistoryOpen, setChatHistoryOpen] = useQueryParam(
|
||||
const [threadId, setThreadId] = useQueryState("threadId");
|
||||
const [chatHistoryOpen, setChatHistoryOpen] = useQueryState(
|
||||
"chatHistoryOpen",
|
||||
BooleanParam,
|
||||
parseAsBoolean.withDefault(false),
|
||||
);
|
||||
const [hideToolCalls, setHideToolCalls] = useQueryParam(
|
||||
const [hideToolCalls, setHideToolCalls] = useQueryState(
|
||||
"hideToolCalls",
|
||||
BooleanParam,
|
||||
parseAsBoolean.withDefault(false),
|
||||
);
|
||||
const [input, setInput] = useState("");
|
||||
const [firstTokenReceived, setFirstTokenReceived] = useState(false);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { MessageContentComplex } from "@langchain/core/messages";
|
||||
import { Fragment } from "react/jsx-runtime";
|
||||
import { isAgentInboxInterruptSchema } from "@/lib/agent-inbox-interrupt";
|
||||
import { ThreadView } from "../agent-inbox";
|
||||
import { BooleanParam, useQueryParam } from "use-query-params";
|
||||
import { useQueryState, parseAsBoolean } from 'nuqs'
|
||||
|
||||
function CustomComponent({
|
||||
message,
|
||||
@@ -74,7 +74,9 @@ export function AssistantMessage({
|
||||
handleRegenerate: (parentCheckpoint: Checkpoint | null | undefined) => void;
|
||||
}) {
|
||||
const contentString = getContentString(message.content);
|
||||
const [hideToolCalls] = useQueryParam("hideToolCalls", BooleanParam);
|
||||
const [hideToolCalls] = useQueryState("hideToolCalls",
|
||||
parseAsBoolean.withDefault(false),
|
||||
);
|
||||
|
||||
const thread = useStreamContext();
|
||||
const isLastMessage =
|
||||
|
||||
Reference in New Issue
Block a user