Skip to content

[Bug]: findPreviousBlockID() #2366

@ariedotcodotnz

Description

@ariedotcodotnz

Operating system

None

Publii version

v.0.47.1 (build 17302)

Post editor

Block editor

Bug description

Location: app/src/components/block-editor/components/Block.vue:268

Problem: The condition if (!currentBlockIndex) incorrectly handles the edge case when findIndex returns -1 (block not found). In this case, !(-1) is false, so the code would decrement to -2 and attempt to return this.editor.content[-2].id, which is undefined or causes an error.

Steps to reproduce

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions