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

Data not saving/loading correctly on the widget screen. #26186

Closed
talldan opened this issue Oct 16, 2020 · 7 comments
Closed

Data not saving/loading correctly on the widget screen. #26186

talldan opened this issue Oct 16, 2020 · 7 comments
Labels
[Feature] Widgets Screen The block-based screen that replaced widgets.php. Needs Testing Needs further testing to be confirmed. REST API Interaction Related to REST API

Comments

@talldan
Copy link
Contributor

talldan commented Oct 16, 2020

Describe the bug
When saving from the widgets screen, I'm seeing lots of issues. I may have a messed up install, but I thought I'd see if anyone else can reproduce.

Something I noticed when looking at HTTP requests is that often widgets would have the same id and number.

To reproduce
Steps to reproduce the behavior:

  1. Go to the customizer widget screen and remove all widgets from all widget areas
  2. Reload to make sure all widgets are gone
  3. Go to the new widget screen and add two paragraphs with different text (e.g. 'test 1' and 'test 2')
  4. Click Update, observe the notification says 'There was an error'.
  5. Notice after updating, the update button can still be clicked.
  6. Click update a few more times.
  7. Reload the page.
  8. Note that the blocks displayed are not those created (for me I ended up with multple paragraphs with the text 'test 1').

Expected behavior
Data is saved correctly.

@talldan talldan added [Feature] Widgets Screen The block-based screen that replaced widgets.php. Needs Testing Needs further testing to be confirmed. REST API Interaction Related to REST API labels Oct 16, 2020
@TimothyBJacobs
Copy link
Member

I think this is because the current code doesn't update the client ID to widget ID mapping after new widgets are created. It only does it when the sidebars are initially loaded. That might be the issue. That's fixed in #26086. I'm curious if you can reproduce that issue on that branch.

@helen
Copy link
Member

helen commented Oct 16, 2020

This happened to me after doing some weird things, I am not sure how many of them are related to the problem surfacing, but wanted to document here anyway:

  • I went to the widgets screen with some existing widgets in there (from Twenty Twenty starter content + an audio widget).
  • I left my "legacy widgets" in place (noticed that I'm came out as I\'m in the preview) and added blocks underneath.
  • I noticed that the YouTube embed widget didn't work (Can't preview video embeds in the editor #26104), and also showed as just the URL on the front end.
  • After updating and viewing on the front end, I navigated to the customizer and clicked the edit icon located next to one of the widgets/blocks.
  • I noticed that all of the blocks show as "Block" in the customizer pane with no disambiguation unless you open.
  • I noticed that the nav menu block shows the nav menu items as links which are clickable (these should no-op).
  • I noticed that I could drag and drop blocks to reorder them and dragged one block above all the legacy widgets.
  • I saved and it appeared to save and display properly (I think).
  • I then navigated back to the widgets screen and tried inserting more blocks underneath the block I had moved above the legacy widgets. One of them was a Twitter embed, which did display the embed preview correctly.
  • After saving, the edit screen remained the way I had entered content but the front-end of my site did not change.
  • I then moved more blocks around and tried adding a new paragraph, at which point all the other blocks I had added including the Twitter embed now showed the text of that new paragraph.
  • I refreshed the screen and then added one more paragraph and then all those blocks also changed to contain the text of that new paragraph.

Even though this is a convoluted workflow, it's completely within reasonable things that a user would use, and leads to data loss. I would consider that to be a significant problem. I will try testing against #26086.

@helen
Copy link
Member

helen commented Oct 16, 2020

Testing with #26086 and everything seems to save correctly (if slowly), including the workaround ability to insert blocks in between legacy widgets by switching into the customizer. The one thing I noticed was that the first time I tried to save after applying #26086 I got There was an error. can't access property "id", g is undefined, after that I got the correct Widgets saved. message.

@TimothyBJacobs
Copy link
Member

Even with #26086 applied, you might see a similar bug due to #26252.

@noisysocks
Copy link
Member

noisysocks commented Jan 6, 2021

Possibly the same bug as #26252 or #27173.

@noisysocks
Copy link
Member

Does this still happen?

@talldan
Copy link
Contributor Author

talldan commented May 21, 2021

I think it's ok to close this now, I haven't noticed it for a while.

@talldan talldan closed this as completed May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Widgets Screen The block-based screen that replaced widgets.php. Needs Testing Needs further testing to be confirmed. REST API Interaction Related to REST API
Projects
None yet
Development

No branches or pull requests

4 participants