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

Bug in template part crashes site-editor menu, so I am unable to reset it. #60587

Closed
mikeybinns opened this issue Apr 9, 2024 · 2 comments
Closed
Labels
[Type] Bug An existing feature does not function as intended

Comments

@mikeybinns
Copy link
Contributor

Description

I am developing a new header template part. I made a mistake in my code of one of my custom blocks, but now my admin page cannot reset the header template part to continue dev because that page crashes.

I understand there is an issue with my code, but I'm not reporting the crash in the block itself, but the inability for me to reset the template part after the code breaks. Please see my GIF below.

Ideally, if the template part crashes, the menu should show the same error as the edit-page section in the preview window, and allow me to reset the template part back to the file state (remove customisations).

In case it is needed, the issue with my code was in the save component of my block. I had an attribute that was not set and I was trying to use startsWith on the undefined attribute.

Step-by-step reproduction instructions

  1. Create a header template part.
  2. Select that template part as the active template (potentially make changes to save it to the database).
  3. Force an error in that template part by breaking a block that is contained in the template part. This may be any error but also may only be an error in the Save component of a static block.
  4. Try and access the template part via the site-editor.

Screenshots, screen recording, code snippet

wp-crash-issue
Description of GIF recording:
I can see my template part has an issue if I view in the site editor via a page edit screen, it show the message (and I also highlight that it is indeed the header template part)
Then I go to the Patterns menu and show that those work fine
Then when I click the "header" template part section, that section of the site crashes and just shows a black screen.
Then, even when I try and go back via the browser, it stays crashed. The only way to fix it is by hitting enter with the url selected to force the page to reload completely.

Environment info

Wordpress 6.5
Gutenberg not installed
No other plugins installed.

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

@mikeybinns mikeybinns added the [Type] Bug An existing feature does not function as intended label Apr 9, 2024
@annezazu
Copy link
Contributor

annezazu commented Apr 9, 2024

Hey @mikeybinns! Thanks for opening this. What happens if you reset it from the overall index page like the video below?

Screen.Recording.2024-04-09.at.9.44.19.AM.mov

@mikeybinns
Copy link
Contributor Author

Hey, yeah that works fine. I'll be honest, I completely missed that section of the admin, so that's good to know :)

@annezazu annezazu closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants