fix: defaults
This commit is contained in:
@@ -109,13 +109,13 @@ export function LogosPage() {
|
||||
[recollectionId]
|
||||
)
|
||||
|
||||
const initialContent = useMemo(
|
||||
() =>
|
||||
recollectionId && activePageId
|
||||
? getLogosContentForPage(recollectionId, activePageId) ?? undefined
|
||||
: undefined,
|
||||
[recollectionId, activePageId, reloadKey]
|
||||
)
|
||||
const initialContent = useMemo(() => {
|
||||
if (!recollectionId || !activePageId) return undefined
|
||||
const content = getLogosContentForPage(recollectionId, activePageId)
|
||||
// BlockNote requires a non-empty array of blocks; use undefined for default empty doc.
|
||||
if (!content || !Array.isArray(content) || content.length === 0) return undefined
|
||||
return content
|
||||
}, [recollectionId, activePageId, reloadKey])
|
||||
|
||||
const editor = useCreateBlockNote(
|
||||
{ schema: logosSchema, initialContent },
|
||||
|
||||
Reference in New Issue
Block a user