mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
feat(workspace-dialog): route new workspace from llm_setup and seed query cache
This commit is contained in:
parent
b010468a96
commit
6f34bdf6b5
1 changed files with 16 additions and 1 deletions
|
|
@ -28,6 +28,8 @@ import {
|
|||
import { Input } from "@/components/ui/input";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { trackWorkspaceCreated } from "@/lib/posthog/events";
|
||||
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||
import { queryClient } from "@/lib/query-client/client";
|
||||
|
||||
const formSchema = z.object({
|
||||
name: z.string().min(1, "Name is required"),
|
||||
|
|
@ -67,7 +69,20 @@ export function CreateWorkspaceDialog({ open, onOpenChange }: CreateWorkspaceDia
|
|||
|
||||
trackWorkspaceCreated(result.id, values.name);
|
||||
|
||||
router.push(`/dashboard/${result.id}/new-chat`);
|
||||
// Seed the gate's query so it resolves without a loader flash, and
|
||||
// route straight to onboarding vs. new-chat on the first hop.
|
||||
if (result.llm_setup) {
|
||||
queryClient.setQueryData(
|
||||
cacheKeys.modelConnections.setupStatus(result.id),
|
||||
result.llm_setup
|
||||
);
|
||||
}
|
||||
const needsSetup = result.llm_setup?.status === "needs_setup";
|
||||
router.push(
|
||||
needsSetup
|
||||
? `/dashboard/${result.id}/onboard`
|
||||
: `/dashboard/${result.id}/new-chat`
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Failed to create workspace:", error);
|
||||
setIsSubmitting(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue