WordPress / gutenberg

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

Footnotes not saved if the Custom Fields panel is open #54653

Open Screenfeed opened 1 year ago

Screenfeed commented 1 year ago

Description

The footnotes block doesn't save new footnotes if the Custom Fields panel is open. This happens only if footnotes already exist and we want to add more of them after the post has been saved at least once.

Ticket on trac. The issue was reproduced during Test triage.

Step-by-step reproduction instructions

  1. Create a post with title and some content.
  2. Add a footnotes block: add 1 or 2 footnotes to your content.
  3. Save your post.
  4. While still in your block editor, go to Options (top right of the screen), Preferences (very bottom of the menu), Panels, enable "Custom fields", click "Show & Reload Page".
  5. Now the "Custom fields" panel is displaying your post's metas.
  6. Note that the meta storing the footnotes' content is named footnotes, without the _ prefix, so it is a public meta. Its value is a JSON string.
  7. Edit your post content by adding another footnote and save your post.
  8. Reload the page:
    • The anchor in the post content is still there.
    • The new footnote has disappeared from the footnotes block.
    • The post meta in the "Custom fields" panel doesn't contain the new footnote either.

Screenshots, screen recording, code snippet

No response

Environment info

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

Mamaduka commented 1 year ago

I think the cause is the same as described in #23078.

Screenfeed commented 1 year ago

I missed this ticket, I was focused on "footnotes" 😞 Indeed I expect any block using public post metas to fail.

mrfoxtalbot commented 1 year ago

Thank you for connecting the dots @Mamaduka and thanks for confirming @Screenfeed.

I will go ahead and close this as "duplicate".

Mamaduka commented 1 year ago

@mrfoxtalbot, we might want to keep this open. There might be an intermediate fix for Footnotes by making the meta protected via the is_protected_meta filter.