Add dialog/select/textarea/label/progress/sonner components and wire
a Toaster into Providers. New zod schemas in lib/schemas/case.ts
mirror CaseCreateRequest/CaseUpdateRequest and feed react-hook-form
validation.
CaseEditDialog on the case detail Actions tab posts PUT /api/cases/{n}
with optimistic cache patching via useUpdateCase, showing toast
feedback on success/error.
shadcn's <Form> registry entry skipped at init (missing from the
nova preset); the dialog uses RHF directly against the same Input/
Textarea/Select primitives.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
782 B
TypeScript
22 lines
782 B
TypeScript
"use client";
|
|
|
|
import { useState, type ReactNode } from "react";
|
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
import { Toaster } from "@/components/ui/sonner";
|
|
import { makeQueryClient } from "@/lib/api/client";
|
|
|
|
/**
|
|
* Client-side providers. Creates ONE QueryClient instance per browser session
|
|
* via useState — Next.js App Router recreates the function on every render,
|
|
* so a naive `const client = makeQueryClient()` would dump the cache each time.
|
|
*/
|
|
export function Providers({ children }: { children: ReactNode }) {
|
|
const [queryClient] = useState(() => makeQueryClient());
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
{children}
|
|
<Toaster position="top-left" richColors closeButton dir="rtl" />
|
|
</QueryClientProvider>
|
|
);
|
|
}
|