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: Fix compatibility issues with WordPress 5.6/Gutenberg 9.5 #673

Merged
merged 2 commits into from
Dec 7, 2020

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Dec 4, 2020

I was testing Gutenberg 9.5 on wordcamp.org earlier today and found some date & api bugs.

  • Dates: Moment had a wider range of permitted date formats, but now that wp.date uses date-fns, these unsupported dates fail and crash the block. Seen on the frontend, a page with the schedule block.
  • API: At some point, the requests made by the schedule block stopped being understood by getEntities/getEntityRecords, and now always return null. Seen in the editor, the schedule block never stops "loading" even though the requests finish.

The fix for the first is straightforward, I don't think it has any unexpected side-effects. The second issue is "fixed" for now by removing _fields, in the interest of getting something working. I'll continue investigating the root issue, but this could be merged if we need a quick fix.

How to test the changes in this Pull Request:

Update gutenberg to 9.5 (for the date issue). The API issue is visible on production currently (WP 5.6).

  1. Have sessions on your site
  2. Add a schedule block to a page
  3. View the block in the editor, it should work.
  4. Publish the page, the schedule should appear correct on the frontend
  5. The dates & times should appear correct

@ryelle ryelle added [Type] Bug [Component] Blocks All custom blocks (Speakers, CrowdCast, Live Schedule, etc) labels Dec 4, 2020
@ryelle ryelle self-assigned this Dec 4, 2020
@iandunn
Copy link
Member

iandunn commented Dec 4, 2020

Moment had a wider range of permitted date formats, but now that wp.date uses date-fns, these unsupported dates fail and crash the block

That seems like a back-compat break w/ wp.date to me. What do you think about fixing that upstream instead of here?

Moment had a wider range of permitted date formats, but now that wp.date uses date-fns, these unsupported dates fail and crash the block.
@ryelle
Copy link
Contributor Author

ryelle commented Dec 7, 2020

Looks like the date issue will be fixed in GB 9.6, since they've reverted the moment/date-fns switch: WordPress/gutenberg#27398

I spent some time Friday trying to figure out what exactly the fields issue is- turns out it is a core bug, so I've got a PR for that up here: WordPress/gutenberg#27526 — this workaround can go in for now, and if/when that's merged we can bring back the fields subset.

I'm going to merge this so we can jump up to 9.5, and since the _fields issue is happening on production already. When 9.6 comes out, I'll check dates again and update.

At some point, these requests stopped being understood by `getEntities`/`getEntityRecords`, and now always return null. Removing them for now to fix the blocks.
@ryelle ryelle force-pushed the fix/blocks-and-56 branch from c6af4a5 to 34bf80c Compare December 7, 2020 16:33
@ryelle ryelle merged commit d6bead9 into production Dec 7, 2020
@ryelle ryelle deleted the fix/blocks-and-56 branch December 7, 2020 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Blocks All custom blocks (Speakers, CrowdCast, Live Schedule, etc) [Type] Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants