Skip to content

Getting error in nextjs #1260

Closed
Closed
@nazmul-bzs

Description

@nazmul-bzs

Hello BlockNote Team,
I am using BlockNote in one of my nextjs projects. On the left panel of the page, I have a list of notes and on the right panel, there is Editor. When I click a note title on the left panel, it fetches the content from an API and passes the content to the right panel Editor. But, I got an error when I navigate to a previously selected note. Can you please help me to fix this issue?

I have attached a screenshot, a video and the code of BlockNote component I have used in my project.

image

block_note_error.mp4
import { type Block, type PartialBlock } from '@blocknote/core';
import '@blocknote/core/fonts/inter.css';
import { BlockNoteView } from '@blocknote/mantine';
import '@blocknote/mantine/style.css';
import { useCreateBlockNote } from '@blocknote/react';

export type BlockNoteEditorProps = {
    initialContent: PartialBlock[];
    handleChange: (content: Block[]) => void;
};

export const BlockNoteEditor = ({ initialContent, handleChange }: BlockNoteEditorProps): React.ReactNode => {
    const editor = useCreateBlockNote(
        {
            initialContent,
        },
        [initialContent],
    );

    return (
        <div>
            <BlockNoteView
                editor={editor}
                onChange={() => {
                    handleChange(editor.document);
                }}
            />
        </div>
    );
};

export default BlockNoteEditor;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions