WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.16k stars 4.05k forks source link

5.5:Preview window does not reload automatically with post updates #24562

Open ddryo opened 3 years ago

ddryo commented 3 years ago

Thank you for your development. With the 5.5 update, Gutenberg is even better.

However, I have one thing to ask, so I would like to ask you a question.

The preview window opened in "Preview in new tab" no longer reloads automatically when the post is updated.

Is this normal behavior from 5.5? Is it changed for some reason?

I'm sad that automatic reload was so convenient.

If it's a bug, I hope it will be fixed...

Computerbuddha commented 3 years ago

Same issue here. Hope it´s a bug. Also now you have two (instead of one) clicks for the preview: 1. "Preview" -> Popup -> 2. "Preview in a new tab".

talldan commented 3 years ago

@ddryo Thanks for reporting this, it does indeed seem to be a bug/regression in v5.5. I think the problem is the behavior is tied to the visibility of the 'Preview in new Tab' button. If you leave the new Preview menu open, then save a change, you'll notice the preview does update like it used to.

What seems to be happening is that previewWindow is undefined here: https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/post-preview-button/index.js#L131-L132

The component must be losing it's reference to previewWindow when umounted.

@Computerbuddha There's a separate issue for the two clicks - https://github.com/WordPress/gutenberg/issues/24584.