Skip to content

TypeError: Cannot read properties of null (reading 'can') #7849

@FedorT22

Description

@FedorT22

Affected Packages

@tiptap/extension-text-align

Version(s)

3.23.1

Bug Description

After upgrading @tiptap/extension-text-align from from 3.22.3 to 3.23.1, tiptap editor toolbar controls crash with the following error:

TypeError: Cannot read properties of null (reading 'can')

Place where it fails:

  const editorState = useEditorState({
    editor,
    selector: (ctx) => {
      const editor = ctx.editor;

      return {
        isBold: editor?.isActive('bold') ?? false,
        canBold: editor?.can().chain().toggleBold().run() ?? false,

Issue reproduces only for development mode, when running the React app in strict mode.

Current Workaround:

const editor = useEditor({
    immediatelyRender: false,

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

app should not fail in development and production modes.

Additional Context (Optional)

similiar issue
mantinedev/mantine#8899

Dependency Updates

  • Yes, I've updated all my dependencies.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions