feat(app): close new sketch modal while on already existing sketch page

This commit is contained in:
dextmorgn
2025-11-17 23:02:31 +01:00
parent dcf3b639bc
commit 5596e60bf3

View File

@@ -30,7 +30,7 @@ interface NewSketchProps {
export default function NewSketch({ children }: NewSketchProps) {
const [open, setOpen] = useState(false)
const router = useRouter()
const { investigationId } = useParams({ strict: false })
const { investigationId, id: sketchId } = useParams({ strict: false })
const queryClient = useQueryClient()
const {
@@ -59,6 +59,7 @@ export default function NewSketch({ children }: NewSketchProps) {
queryKey: queryKeys.investigations.sketches(investigationId)
})
}
if (sketchId) setOpen(false)
} else {
toast.error(result.error || 'Failed to create sketch.')
}