Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocks that use entities are not saved in the widget editors #32756

Closed
talldan opened this issue Jun 17, 2021 · 8 comments · Fixed by #32761
Closed

Blocks that use entities are not saved in the widget editors #32756

talldan opened this issue Jun 17, 2021 · 8 comments · Fixed by #32761
Assignees
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@talldan
Copy link
Contributor

talldan commented Jun 17, 2021

Description

When using a full site editing block (e.g. Site tagline) or reusable blocks in the widget editors, changes to those blocks are not being saved.

I imagine the issue is that the widget editor doesn't save all the edited entities. This also exposes the question of whether the editor now needs to replicate the UI that the post and site editors have for entities. I think the answer to that is 'yes', but it might be a challenge in the customizer.

An additional thing to mention is that in the customizer changes to those entity based blocks are not being reflected in the preview

Step-by-step reproduction instructions

  1. Add a Site Tagline or Reusable block
  2. Make changes to it
  3. Save
  4. Reload

Expected behaviour

Changes to the blocks are kept

In the customizer, changes are shown in the preview

Actual behaviour

Changes to the blocks are lost

In the customizer, changes are not shown in the preview

@talldan talldan added [Type] Bug An existing feature does not function as intended [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Feature] Full Site Editing [Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. labels Jun 17, 2021
@talldan talldan changed the title Blocks that use entities are not saved in the widget editor Blocks that use entities are not saved in the widget editors Jun 17, 2021
@noisysocks
Copy link
Member

Just noting we could consider disabling these blocks in the widgets editors as a temporary solution for 5.8.

@getdave
Copy link
Contributor

getdave commented Jun 17, 2021

Just noting we could consider disabling these blocks in the widgets editors as a temporary solution for 5.8.

I'd say that would be reasonable for 5.8.

Whilst it's not ideal to lose these blocks, it seems like given its scope this could be quite a large issue to solve in such a short space of time.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 17, 2021
@getdave
Copy link
Contributor

getdave commented Jun 17, 2021

In case we need it (which I think we will) here is a PR that disables all the FSE blocks in the Customizer. I'd appreciate some input on which blocks we can safely retain (if any):

#32761

@talldan
Copy link
Contributor Author

talldan commented Jun 17, 2021

Thinking about what other options there are.

  • Adding the entity saving flow to the standalone widget screen might not be too difficult. Mostly a matter of copying the post/site editor implementation.
  • In the customize widget screen, there are two separate problems.
    • First the saving flow. To fix this would mean hooking into the customizer's publish button, and right now I'm not sure how possible that is.
    • The second issue is the preview not updating when making changes, this doesn't seem to happen because BlockEditorProvider's onChange or onInput callbacks are not triggered for blocks that use entities. Is this a bug with the BlockEditorProvider, or should the widget editor be hooking into these changes in some other way? -

@kevin940726
Copy link
Member

kevin940726 commented Jun 18, 2021

Might be worth mentioning that the "Preview" feature also doesn't work for FSE blocks even in the post editor. This might be related, as the problem could be in the FSE side but not in the widgets screen. Maybe we should fix it there, not sure though. I know very little about FSE 😅.

Kapture.2021-06-18.at.16.33.36.mp4

First the saving flow. To fix this would mean hooking into the customizer's publish button, and right now I'm not sure how possible that is.

This should be possible, hacky, but possible. We might just need to attach an event to the publish button and call event.stopPropagation(). Or we can hide the original button and portal a new one there.

@talldan
Copy link
Contributor Author

talldan commented Jun 21, 2021

Might be worth mentioning that the "Preview" feature also doesn't work for FSE blocks even in the post editor.

Good spot. I wonder if that's a known issue.

@draganescu
Copy link
Contributor

Let's move forward with @getdave 's PR that disables the FSE blocks in widget areas. These blocks are quite new and they're not meant for classic themes anyway, yet at least.

@getdave
Copy link
Contributor

getdave commented Jun 24, 2021

I've raised a followup in #32952 to track the need to reinstate these blocks in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Widgets Customizer Ability to add and edit blocks in Customize → Widgets. [Feature] Widgets Screen The block-based screen that replaced widgets.php. [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants