Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Title: deleting the block crashes the parent group block #31115

Closed
vindl opened this issue Apr 23, 2021 · 6 comments
Closed

Post Title: deleting the block crashes the parent group block #31115

vindl opened this issue Apr 23, 2021 · 6 comments
Assignees
Labels
[Block] Post Title Affects the Post Title Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@vindl
Copy link
Member

vindl commented Apr 23, 2021

Steps to reproduce:

  1. Open the Site Editor on a test site that has TT1 Blocks theme active.
  2. Open the page template from the browsing sidebar.
  3. Select the Post Title block and press delete.
  4. Notice that the containing group block crashes and display "This block has encountered an error and cannot be previewed." error message.

Before:
Screen Shot 2021-04-23 at 3 09 42 AM

After:
Screen Shot 2021-04-23 at 3 10 05 AM

@vindl vindl added [Type] Bug An existing feature does not function as intended [Feature] Full Site Editing [Block] Post Title Affects the Post Title Block labels Apr 23, 2021
@JustinyAhin
Copy link
Member

I've tried to reproduce this, but I can not.

When I press delete on the post title, it rather deletes the characters in the title.

My setup:
WordPress 5.8-alpha-50761
Gutenberg 10.5.3 only activated
TT1 blocks

macOS 11.1
Firefox Developer Edition 89.0b6

CleanShot.2021-05-03.at.10.19.09.mp4

@devfle
Copy link
Contributor

devfle commented May 3, 2021

I can confirm it. Steps to reproduce:

  1. Add group block to your site
  2. Insert a random block inside it e.g. shortcode
  3. Save / publish the page and reload it
  4. select the block inside the group block
  5. press backspace and delete it.

The group block crashes an the console fires some exceptions e.g. "Uncaught Error: An error occurred while running 'mapSelect': Cannot read property 'title' of undefined"

@JustinyAhin
Copy link
Member

I can confirm it. Steps to reproduce:

1. Add group block to your site

2. Insert a random block inside it e.g. shortcode

3. Save / publish the page and reload it

4. select the block inside the group block

5. press backspace and delete it.

The group block crashes an the console fires some exceptions e.g. "Uncaught Error: An error occurred while running 'mapSelect': Cannot read property 'title' of undefined"

I'll give a look again. I've likely not reproduced correctly

@bbertucc
Copy link

bbertucc commented May 4, 2021

I found this same issue when deleting a block in the footer while using Site Editor. The block was the only block in the footer. When deleting it, this popped up..
Screen Shot 2021-05-04 at 3 43 58 PM

@david-szabo97 david-szabo97 self-assigned this May 27, 2021
@david-szabo97
Copy link
Member

david-szabo97 commented Jun 1, 2021

UPDATE: After some extensive investigation, it looks like this problem occurs in any container blocks.

Error is happening in useBlockProps, at different points usually. But mostly it happens at

The block is still being rendered after it's deleted. The useSelect on line 72 is called because the store state changes so it runs again and crashes the block because the block state doesn't exist anymore in the store state.

I couldn't figure out why but using the "Remove block" option from the dropdown doesn't cause any crashes. So it's tied to the backspace keyboard shortcut in some way 🤔

Investigating further....

@leutrimhusaj
Copy link
Contributor

I think after merge of #32088 this could be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Title Affects the Post Title Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants