diff --git a/src/app/(app)/preview/page.tsx b/src/app/(app)/preview/page.tsx index 264b479e39..5fb8142b43 100644 --- a/src/app/(app)/preview/page.tsx +++ b/src/app/(app)/preview/page.tsx @@ -13,7 +13,6 @@ import type { import { simpleCamelcaseKeys } from '@mx-space/api-client' -import { previewDataAtom } from '~/atoms/preview' import { ErrorBoundary } from '~/components/common/ErrorBoundary' import { Paper } from '~/components/layout/container/Paper' import { NoteMetaBar, NoteRootBanner } from '~/components/modules/note' @@ -67,7 +66,7 @@ const safeParse = (value: string) => { return null } } - +const previewDataAtom = atom(null) export default function PreviewPage() { useIsomorphicLayoutEffect(() => { const search = location.search @@ -97,6 +96,7 @@ export default function PreviewPage() { if (exist) { const parsedData = safeParse(exist) + if (!parsedData) return jotaiStore.set(previewDataAtom, simpleCamelcaseKeys(parsedData)) } diff --git a/src/app/(dashboard)/dashboard/notes/edit/page.tsx b/src/app/(dashboard)/dashboard/notes/edit/page.tsx index 889be7eb61..b92836fd73 100644 --- a/src/app/(dashboard)/dashboard/notes/edit/page.tsx +++ b/src/app/(dashboard)/dashboard/notes/edit/page.tsx @@ -61,6 +61,7 @@ const createInitialEditingData = (): NoteDto => { allowComment: true, id: '', + nid: 0, location: null, coordinates: null, images: [], diff --git a/src/atoms/preview.ts b/src/atoms/preview.ts deleted file mode 100644 index 05893814b8..0000000000 --- a/src/atoms/preview.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { atom } from 'jotai' -import type { NoteModel, PostModel } from '@mx-space/api-client' - -export const previewDataAtom = atom(null)