[Product Editor] Fix blank editor when clicking Add New while already in editor (#43702)
This commit is contained in:
parent
8a7ffac49b
commit
3838975b24
|
@ -0,0 +1,5 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
Comment: No changelog because this fixes a regression that was introduced in the same release.
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,16 @@ export function BlockEditor( {
|
||||||
...settings,
|
...settings,
|
||||||
productTemplate,
|
productTemplate,
|
||||||
} as Partial< ProductEditorSettings > );
|
} as Partial< ProductEditorSettings > );
|
||||||
}, [ settings, postType, productTemplate, productType, layoutTemplate ] );
|
|
||||||
|
// We don't need to include onChange or updateEditorSettings in the dependencies,
|
||||||
|
// since we get new instances of them on every render, which would cause an infinite loop.
|
||||||
|
//
|
||||||
|
// We include productId in the dependencies to make sure that the effect is run when the
|
||||||
|
// product is changed, since we need to synchronize the blocks with the template and update
|
||||||
|
// the blocks by calling onChange.
|
||||||
|
//
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [ layoutTemplate, settings, productTemplate, productId ] );
|
||||||
|
|
||||||
// Check if the Modal editor is open from the store.
|
// Check if the Modal editor is open from the store.
|
||||||
const isModalEditorOpen = useSelect( ( select ) => {
|
const isModalEditorOpen = useSelect( ( select ) => {
|
||||||
|
|
Loading…
Reference in New Issue