Skip to content

useBlockProps rerender block multiple times  #56664

@wpsoul

Description

@wpsoul

Description

I implemented API 3 to blocks and see big degradation of performance. After some research, I found that useBlockProps rerender block multiple times. Also it rerenders blocks when it's in View.

Step-by-step reproduction instructions

  1. Add console.log in edit function
  2. Add useBlockProps and check console. I see 4 times execution, also when I scroll down/up, I see execution when block is in view
  3. Now, remove useBlockProps. Console executed 1 time only

Screenshots, screen recording, code snippet

Monosnap.screencast.2023-11-30.06-07-33.mp4

Environment info

6.4 Wordpress

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Technical FeedbackNeeds testing from a developer perspective.[Type] QuestionQuestions about the design or development of the editor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions