fix: convert from use-query-params to nuqs

This commit is contained in:
bracesproul
2025-03-17 13:14:47 -07:00
parent 706cc7cc1a
commit c8bfb1cdc8
9 changed files with 4121 additions and 2024 deletions

View File

@@ -81,7 +81,8 @@
"vite": "^6.1.0" "vite": "^6.1.0"
}, },
"overrides": { "overrides": {
"react-is": "^19.0.0-rc-69d4b800-20241021" "react-is": "^19.0.0-rc-69d4b800-20241021",
"@langchain/langgraph-checkpoint": "^0.0.16"
}, },
"packageManager": "pnpm@10.5.1+sha512.c424c076bd25c1a5b188c37bb1ca56cc1e136fbf530d98bcb3289982a08fd25527b8c9c4ec113be5e3393c39af04521dd647bcf1d0801eaf8ac6a7b14da313af" "packageManager": "pnpm@10.5.1+sha512.c424c076bd25c1a5b188c37bb1ca56cc1e136fbf530d98bcb3289982a08fd25527b8c9c4ec113be5e3393c39af04521dd647bcf1d0801eaf8ac6a7b14da313af"
} }

6121
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ import { InboxItemInput } from "./inbox-item-input";
import useInterruptedActions from "../hooks/use-interrupted-actions"; import useInterruptedActions from "../hooks/use-interrupted-actions";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { toast } from "sonner"; import { toast } from "sonner";
import { useQueryState } from 'nuqs' import { useQueryState } from "nuqs";
import { constructOpenInStudioURL } from "../utils"; import { constructOpenInStudioURL } from "../utils";
import { HumanInterrupt } from "@langchain/langgraph/prebuilt"; import { HumanInterrupt } from "@langchain/langgraph/prebuilt";

View File

@@ -4,7 +4,7 @@ import { Thread } from "@langchain/langgraph-sdk";
import { useEffect } from "react"; import { useEffect } from "react";
import { getContentString } from "../utils"; import { getContentString } from "../utils";
import { useQueryState, parseAsBoolean } from 'nuqs' import { useQueryState, parseAsBoolean } from "nuqs";
import { import {
Sheet, Sheet,
SheetContent, SheetContent,

View File

@@ -21,7 +21,7 @@ import {
PanelRightClose, PanelRightClose,
SquarePen, SquarePen,
} from "lucide-react"; } from "lucide-react";
import { useQueryState, parseAsBoolean } from 'nuqs' import { useQueryState, parseAsBoolean } from "nuqs";
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom"; import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
import ThreadHistory from "./history"; import ThreadHistory from "./history";
import { toast } from "sonner"; import { toast } from "sonner";

View File

@@ -11,7 +11,7 @@ import { MessageContentComplex } from "@langchain/core/messages";
import { Fragment } from "react/jsx-runtime"; import { Fragment } from "react/jsx-runtime";
import { isAgentInboxInterruptSchema } from "@/lib/agent-inbox-interrupt"; import { isAgentInboxInterruptSchema } from "@/lib/agent-inbox-interrupt";
import { ThreadView } from "../agent-inbox"; import { ThreadView } from "../agent-inbox";
import { useQueryState, parseAsBoolean } from 'nuqs' import { useQueryState, parseAsBoolean } from "nuqs";
function CustomComponent({ function CustomComponent({
message, message,
@@ -74,7 +74,8 @@ export function AssistantMessage({
handleRegenerate: (parentCheckpoint: Checkpoint | null | undefined) => void; handleRegenerate: (parentCheckpoint: Checkpoint | null | undefined) => void;
}) { }) {
const contentString = getContentString(message.content); const contentString = getContentString(message.content);
const [hideToolCalls] = useQueryState("hideToolCalls", const [hideToolCalls] = useQueryState(
"hideToolCalls",
parseAsBoolean.withDefault(false), parseAsBoolean.withDefault(false),
); );

View File

@@ -18,4 +18,4 @@ createRoot(document.getElementById("root")!).render(
<Toaster /> <Toaster />
</NuqsAdapter> </NuqsAdapter>
</BrowserRouter>, </BrowserRouter>,
); );

View File

@@ -12,7 +12,7 @@ import {
type UIMessage, type UIMessage,
type RemoveUIMessage, type RemoveUIMessage,
} from "@langchain/langgraph-sdk/react-ui"; } from "@langchain/langgraph-sdk/react-ui";
import { useQueryState } from 'nuqs' import { useQueryState } from "nuqs";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { LangGraphLogoSVG } from "@/components/icons/langgraph"; import { LangGraphLogoSVG } from "@/components/icons/langgraph";
@@ -133,9 +133,7 @@ export const StreamProvider: React.FC<{ children: ReactNode }> = ({
_setApiKey(key); _setApiKey(key);
}; };
const [assistantId, setAssistantId] = useQueryState( const [assistantId, setAssistantId] = useQueryState("assistantId");
"assistantId",
);
if (!apiUrl || !assistantId) { if (!apiUrl || !assistantId) {
return ( return (

View File

@@ -1,7 +1,7 @@
import { validate } from "uuid"; import { validate } from "uuid";
import { getApiKey } from "@/lib/api-key"; import { getApiKey } from "@/lib/api-key";
import { Thread } from "@langchain/langgraph-sdk"; import { Thread } from "@langchain/langgraph-sdk";
import { useQueryState } from 'nuqs' import { useQueryState } from "nuqs";
import { import {
createContext, createContext,
useContext, useContext,