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

Reusable movable modal #1674

Merged
merged 14 commits into from
Jun 17, 2020
Merged

Reusable movable modal #1674

merged 14 commits into from
Jun 17, 2020

Conversation

srallen
Copy link
Contributor

@srallen srallen commented Jun 12, 2020

Please request review from @zooniverse/frontend team. If PR is related to design, please request review from @beckyrother in addition.

Package: lib-react-components

Describe your changes:
The heart of this was already approved in #1661, but it was reverted because it was breaking the next.js app builds with a window is not defined error when building for SSR. After nearly two days of debugging, I found that the issue was with react-draggable, a dependency of react-rnd. It seems the likely culprit is what was described in react-grid-layout/react-draggable#472. It appears this has been patched, but I can't 100% confirm this because I couldn't figure out how to successfully get react-rnd to use an updated version of react-draggable using yarn resolutions in the workspace. I can get the builds to work again by locking react-rnd to version 10.1.0, which is not a longterm solution, but works for now.

Please do check that the builds are working for you either using yarn build or docker-compose -f docker-compose-prod.yml build --pull

Review Checklist

General

  • Are the tests passing locally and on Travis?
  • Is the documentation up to date?

Components

Apps

  • Does it work in all major browsers: Firefox, Chrome, Edge, Safari?
  • Does it work on mobile?
  • Can you yarn panic && yarn bootstrap or docker-compose up --build and app works as expected?

Publishing

  • Is the changelog updated?
  • Are the dependencies updated for apps and libraries that are using the newly published library?

Post-merging

@srallen srallen added bug Something isn't working enhancement New feature or request labels Jun 12, 2020
@srallen srallen added this to the IMLS text transcription milestone Jun 12, 2020
@srallen srallen requested a review from wgranger June 12, 2020 19:51
Copy link
Contributor

@wgranger wgranger left a comment

Choose a reason for hiding this comment

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

Unfortunately I could not get this to build. To test it out I removed node_modules and did a fresh yarn install, followed by a yarn build at the root level. The build works fine until getting to the @zooniverse/fe-content-pages where I see the window is not defined error.

Does this match the original error, or is there something I could be doing incorrectly in preparing the build?

@srallen
Copy link
Contributor Author

srallen commented Jun 16, 2020

@wgranger that's annoying. I thought it was working w/ 10.1.0. I locked it to 10.0.0 which locks react-draggable to v3.x instead of 4.0.3 (which I had thought worked). Try it again and also double check the react-draggable version is v.3.x by using yarn why react-draggable. Thanks!

@eatyourgreens
Copy link
Contributor

I've tried

yarn panic-button
yarn bootstrap

on this branch, then yarn build for each of the Next apps, and they built without errors.

@wgranger the packages have to be built in a certain order, so make sure to run the bootstrap script first, to build the app dependencies, before building the apps.

@eatyourgreens
Copy link
Contributor

Here's my local setup.

yarn why v1.22.4
[1/4] 🤔  Why do we have the module "react-draggable"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "react-draggable@4.2.0"
info Has been hoisted to "react-draggable"
info Reasons this module exists
   - "workspace-aggregator-085ab373-3112-404c-9b3b-f7a74c02fa21" depends on it
   - Hoisted from "_project_#@zooniverse#classifier#react-rnd#react-draggable"
   - Hoisted from "_project_#@zooniverse#fe-content-pages#@storybook#react#@storybook#core#@storybook#ui#react-draggable"
info Disk size without dependencies: "504KB"
info Disk size with unique dependencies: "732KB"
info Disk size with transitive dependencies: "860KB"
info Number of shared dependencies: 6
=> Found "react-rnd#react-draggable@3.3.0"
info This module exists because "_project_#@zooniverse#react-components#react-rnd" depends on it.
info Disk size without dependencies: "428KB"
info Disk size with unique dependencies: "656KB"
info Disk size with transitive dependencies: "784KB"
info Number of shared dependencies: 6
✨  Done in 2.31s.

So react components uses version 3 but content pages uses 4, via the storybook?

@srallen
Copy link
Contributor Author

srallen commented Jun 16, 2020

@eatyourgreens yeah, storybook uses it, but client side, so it doesn't error like the next.js apps did with >4.x for react-draggable. I think the latest version might work, but react-rnd hasn't updated yet. Could issue a PR for that at another time.

@srallen srallen mentioned this pull request Jun 16, 2020
18 tasks
* Swap out for reusable component. Minor UI fix to MovableModal

* Switch test to pending temporarily
@srallen
Copy link
Contributor Author

srallen commented Jun 17, 2020

I merged #1676 into this which is approved by @shaunanoordin

@srallen srallen requested a review from wgranger June 17, 2020 19:39
Copy link
Contributor

@wgranger wgranger left a comment

Choose a reason for hiding this comment

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

All good. Running yarn panic-button and yarn bootstrap first put things in order. This is building fine and still functions as expected on Storybook

@github-actions github-actions bot added the approved This PR is approved for merging label Jun 17, 2020
@srallen srallen merged commit 817e586 into master Jun 17, 2020
@srallen srallen added this to Done in Shared Components via automation Jun 17, 2020
@srallen srallen deleted the reusable-movable-modal branch June 17, 2020 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved for merging bug Something isn't working enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants