Codeinwp / templates-patterns-collection

21 stars 6 forks source link

Navigation Block Error: 'This block has encountered an error and cannot be previewed.' #359

Closed poonam279 closed 3 months ago

poonam279 commented 5 months ago

Description

If the Templates Patterns Collection plugin is active and we add a navigation block, we encounter the following error message:

"This block has encountered an error and cannot be previewed."

Disabling the 'Templates Patterns Collection' plugin allows the navigation block to be added and function correctly.

Step-by-step reproduction instructions

  1. Install and activate the 'Templates Patterns Collection' plugin.
  2. Attempt to add a navigation block to a page or post.
  3. Observe the error message: "This block has encountered an error and cannot be previewed."Collection

Screenshots, screen recording, code snippet or Help Scout ticket

Screencast: https://vertis.d.pr/i/lNmsjb

HS: https://secure.helpscout.net/conversation/2612159636/420613/

Environment info

No response

Is the issue you are reporting a regression

No

Soare-Robert-Daniel commented 5 months ago

The crash is caused by this import: https://github.com/Codeinwp/templates-patterns-collection/blob/3994079875f2dde8ba99130c8d725078437a1844/editor/src/plugins/site-editor-extension.js#L13

The imported functions are deprecated, and we must switch to @wordpress/editor (Reference: https://github.com/WordPress/gutenberg/blob/06198d157f1c5341b4ce931948422b417564feba/packages/edit-post/src/deprecated.js#L83 )

poonam279 commented 5 months ago

I have tested the PR and it resolved the issue.