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

[WIP] Upgraded to Preact 10.3.4 #5639

Closed
wants to merge 9 commits into from

Conversation

nickytonline
Copy link
Contributor

@nickytonline nickytonline commented Jan 22, 2020

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Preact has been upgraded to the latest version, Preact X. This gives us hooks, componentDidCatch, fragments etc. See the official release for the whole rundown. Here is the official migration guide for Preact 8.x to X if you're curious why some changes have been made.

I've done a smoke test of the site on my local. Onboarding worked fine, search is good and the site seems to behaving normally.

Storybook appears to be broken still. This is related to work that needs to be done in #3490 and #2034. I will address that in a separate PR.

Related Tickets & Documents

#4243

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Added to documentation?

  • docs.dev.to
  • readme
  • no documentation needed

[optional] What gif best describes this PR or how it makes you feel?

Some cool X gif

@nickytonline nickytonline requested a review from a team January 22, 2020 03:57
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Jan 22, 2020
@@ -1,4 +1,3 @@
import 'preact/devtools';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed preact/devtools as it no longer exists. preact/debug is what should be used, but it should only be for development purposes. I will address this in another PR.

See Debugging Preact Apps

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@@ -1,9 +1,9 @@
import { h, render } from 'preact';
import { Search } from '../src/components/Search';
import 'focus-visible'
import 'focus-visible';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little prettier action happening in a few files.


document.addEventListener('DOMContentLoaded', () => {
const root = document.getElementById('nav-search-form-root');

render(<Search />, root, root.firstElementChild);
render(<Search />, root);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the upgrade. VDOM diffing works the way it does in most other libraries, e.g. React.

@nickytonline
Copy link
Contributor Author

nickytonline commented Jan 22, 2020

The codeclimate issues appear to be complaining about code duplication for PropTypes but it's not an issue. The prop types are different in each case.

The other issue is related to jest issues as test scores have gone from A -> F 😬

@nickytonline
Copy link
Contributor Author

I need to sort out the tests in the frontend as a lot of the snapshots changed, but the structure is different and information appears to be missing. Maybe Preact X is not compatible with some of the tools we were using for snapshot testing with Preact. Either way, gotta get it sorted. 😉

image

@nickytonline nickytonline changed the title Upgrade to Preact X [WIP] Upgrade to Preact X Jan 22, 2020
@pr-triage pr-triage bot removed the PR: unreviewed bot applied label for PR's with no review label Jan 22, 2020
@nickytonline
Copy link
Contributor Author

Tiny update. It looks like there are issues with preact-render-spy and Preact X. See mzgoddard/preact-render-spy#92.

@mstruve mstruve removed the request for review from a team January 22, 2020 14:04
@nickytonline nickytonline force-pushed the nickytonline/upgrade-to-preact-x branch from 2a6deaf to 516f504 Compare January 22, 2020 15:11
@maestromac maestromac removed their request for review January 22, 2020 23:25
@nickytonline
Copy link
Contributor Author

I spoke briefly with Jason Miller from Preact, and he is going to look into getting preact-render-spy etc. fixed up. So for the time being, I will put this PR on hold.

@nickytonline nickytonline changed the title [WIP] Upgrade to Preact X [WIP] Upgraded to Preact 10.3.4 Mar 24, 2020
@nickytonline nickytonline force-pushed the nickytonline/upgrade-to-preact-x branch from 822921e to a28fe97 Compare March 24, 2020 13:40
@nickytonline nickytonline requested review from a team as code owners March 24, 2020 13:40
@nickytonline nickytonline requested review from rhymes and removed request for a team March 24, 2020 13:40
@rhymes rhymes removed their request for review March 24, 2020 15:29
@joshpuetz
Copy link
Contributor

@nickytonline Seems like https://github.com/mzgoddard/preact-render-spy might be abandoned: there's a Preact X fork up at https://github.com/shelacek/preact-render-spy. What do we use preact-render-spy for anyway? Is using a pure enzyme approach like https://github.com/preactjs/enzyme-adapter-preact-pure a replacement?

@nickytonline
Copy link
Contributor Author

@nickytonline Seems like mzgoddard/preact-render-spy might be abandoned: there's a Preact X fork up at shelacek/preact-render-spy. What do we use preact-render-spy for anyway? Is using a pure enzyme approach like preactjs/enzyme-adapter-preact-pure a replacement?

@joshpuetz, I tried the fork of preact-render-spy and it does not work. We use preact-render-spy for snapshot testing. It does appear to be abandoned although Jason Miller talked about fixing it up. See this Tweet thread between Jason and I.

Also, I'm looking to move away from snapshot testing in favour of preact-testing-library. Even enzyme is not considered to be the way to test React components now (so Preact as well). As I mentioned on Slack, react-testing-library is the recommended tool by the React team, so I would be inclined to move towards preact-testing-library.

The way I see it panning out is migrating to another testing tool and once all tests are migrated, we can upgrade.

@nickytonline
Copy link
Contributor Author

Closing this @Ridhwana as we'll need to make a new PR which will include the new testing tools.

@rhymes rhymes deleted the nickytonline/upgrade-to-preact-x branch May 28, 2020 08:07
@nickytonline nickytonline mentioned this pull request Jun 1, 2020
11 tasks
@nickytonline nickytonline mentioned this pull request Jun 17, 2020
11 tasks
@Ridhwana Ridhwana mentioned this pull request Jun 17, 2020
11 tasks
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

3 participants