alleyinteractive / apple-news

The Publish to Apple News plugin enables your WordPress blog content to be published to your Apple News channel.
https://wordpress.org/plugins/publish-to-apple-news/
GNU General Public License v3.0
152 stars 70 forks source link

Error notice when a pattern is edited #1106

Closed emeaguiar closed 1 month ago

emeaguiar commented 2 months ago

Description of the bug

When editing any post, if a pattern is edited, the following notice is displayed:

Cannot read properties of undefined (reading 'length')

Steps To Reproduce

  1. Install version 2.4.8, activate the plugin and configure
  2. Open or create a new post, add some content and create a pattern from it
  3. Save or reload the page, select the pattern and click "Edit original"
  4. Notice a notice at the top of the editor

Additional Information

When editing a pattern, some variables are not retrieving the correct meta data, and instead they are being returned as undefined

Demo of the notice appearing

https://github.com/alleyinteractive/apple-news/assets/1379732/865714e0-461f-4648-b5cf-cf7f9571eb1d

Trace of error

https://github.com/alleyinteractive/apple-news/assets/1379732/2ccc07b8-5106-4b47-92a5-4c5e3eb10471

kasparsd commented 2 months ago

Is this happening due to being undefined (instead of null) here:

https://github.com/alleyinteractive/apple-news/blob/fcf53754010955514c7d7c8a998d27e45ab9893d/assets/js/pluginsidebar/sidebar.jsx#L188

kevinfodness commented 1 month ago

The fix for this will be part of the upcoming v2.5.0 release.