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

chore: Update react / cypress / slate / toast & more #6811

Closed
wants to merge 59 commits into from

Conversation

demshy
Copy link
Member

@demshy demshy commented Jun 16, 2023

Summary
A major overhaul of dependencies and required changes in code+tests to adapt to the new library versions. There are obviously a lot of changes and I will try to make a summary here of what was done as well as what was intentionally left out for the next phase (and why).
This version is currently deployed in a private repo and undergoing internal testing with some of our bigger sites where we used as much of the cms functionalities as possible. We are already aware of some bugs, that will be listed below.

Upgraded libraries

  • react 16 -> 18
  • typecript 3 -> 4
    Fixed some minor typing inconsistencies but nothing big.
  • webpack 4 -> 5
    Not many changes needed apart from some configuration files
  • lerna 4 -> 6
    Lerna 6 now uses nx task runner and a lot of scripts for running, building and testing the project had to be adapted. File change watching is now done by Lerna instead of webpack and react-hot-loader was removed (we might need to find an alternative for this?)
  • cypress 9 -> 12
    Needed to adapt the e2e tests for some of the things the new version does differently. Some updated snapshots, some stuff that worked in previous version, but shouldn't have and some stability hacks for slate to be tested properly. There were some suggestions among the community to consider Playwright as a Cypress replacement and i would gladly explore this after this PR.
  • slate 0.4 -> 0.9
    This was the biggest and most time (and nerve) consuming update because it is basically a rewrite of the whole implementation https://docs.slatejs.org/concepts/xx-migrating
    Luckily the serializers were split into two parts - slate>remark>markdown so only slate>remark part needed adaptations. There were a lot of slate plugins that needed work - lists being the most problematic. We were relying on cypress e2e tests to ensure everything works as before but also the tests needed some adaptations to play nice with the new version.

Replaced libaries
Some libraries that are no longer maintained needed to be replaced with alternatives.

  • redux-notifications > react-toastify
    One of the first things that we did because redux-notifications is unmaintained and outdated
  • react-sortable-hoc -> @dnd-kit/sortable
    Sortable elements are not working as they were supposed to after upgrading React. As the react-sortable-hoc github suggests, we moved to the suggested solution. It is already implemented on file lists, but might be a bit more complicated with relations, because it uses react-select and migrating is not as straight forward as it seems: Update the Sortable Multiselect component documentation JedWatson/react-select#5212

Todo

@netlify
Copy link

netlify bot commented Jun 16, 2023

Deploy Preview for decap-www ready!

Name Link
🔨 Latest commit
🔍 Latest deploy log https://app.netlify.com/sites/decap-www/deploys/64a420413583750f6d3ed2f6
😎 Deploy Preview https://deploy-preview-6811--decap-www.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@demshy demshy marked this pull request as ready for review June 16, 2023 10:16
@demshy demshy marked this pull request as draft June 16, 2023 10:16
@demshy demshy changed the title Update react / cypress / slate / toast & more chore: Update react / cypress / slate / toast & more Jun 16, 2023
@demshy demshy force-pushed the pm/react-webpack-slate-toast branch from 5dfe3a4 to 0b060b2 Compare June 27, 2023 14:15
@demshy demshy changed the base branch from master to rc July 25, 2023 06:29
@demshy demshy deleted the branch decaporg:rc July 27, 2023 11:34
@demshy demshy closed this Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant