mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 09:12:40 +02:00
Use hard redirect after search space creation
This commit is contained in:
parent
38fd1995aa
commit
b6ddc233db
1 changed files with 2 additions and 10 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useAtomValue } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import { Loader2, Plus, Search } from "lucide-react";
|
import { Loader2, Plus, Search } from "lucide-react";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
|
|
@ -44,7 +43,6 @@ interface CreateSearchSpaceDialogProps {
|
||||||
export function CreateSearchSpaceDialog({ open, onOpenChange }: CreateSearchSpaceDialogProps) {
|
export function CreateSearchSpaceDialog({ open, onOpenChange }: CreateSearchSpaceDialogProps) {
|
||||||
const t = useTranslations("searchSpace");
|
const t = useTranslations("searchSpace");
|
||||||
const tCommon = useTranslations("common");
|
const tCommon = useTranslations("common");
|
||||||
const router = useRouter();
|
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const { mutateAsync: createSearchSpace } = useAtomValue(createSearchSpaceMutationAtom);
|
const { mutateAsync: createSearchSpace } = useAtomValue(createSearchSpaceMutationAtom);
|
||||||
|
|
@ -65,18 +63,12 @@ export function CreateSearchSpaceDialog({ open, onOpenChange }: CreateSearchSpac
|
||||||
description: values.description || "",
|
description: values.description || "",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Track search space creation
|
|
||||||
trackSearchSpaceCreated(result.id, values.name);
|
trackSearchSpaceCreated(result.id, values.name);
|
||||||
|
|
||||||
// Reset form and close dialog
|
// Hard redirect to ensure fresh state
|
||||||
form.reset();
|
window.location.href = `/dashboard/${result.id}/onboard`;
|
||||||
onOpenChange(false);
|
|
||||||
|
|
||||||
// Redirect to the newly created search space's onboarding
|
|
||||||
router.push(`/dashboard/${result.id}/onboard`);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to create search space:", error);
|
console.error("Failed to create search space:", error);
|
||||||
} finally {
|
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue