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

Upgrade mobx, mobx-react and mobx-state-tree #2009

Merged
merged 7 commits into from
Feb 1, 2021

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented Jan 28, 2021

Update the NextJS apps to use [email protected], [email protected] and [email protected].
Upgrade the classifier to use [email protected], [email protected] and [email protected].
Upgrading mobx-react to 6.3 breaks the classifier tests, so I've left it alone for now.
Rewrite the project preferences store tests to use mobx.when. Previously, the tests were run without waiting for the project preferences to load, which broke in mobx-state-tree 3.16 and higher.
Also fixes a couple of project preferences tests which were accidentally nested inside another test (misplaced }) somewhere) and a typo in the same tests (projects.createActive(project.id) instead of projects.setActive(project.id).)

See #1839 for the major bug that appeared the last time I tried to upgrade the NextJS apps to mobx-react v6. I haven't been able to reproduce it on this branch, testing locally with a production build and PH-TESS.

Package:
app-content-pages
app-project
lib-classifier

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

@eatyourgreens
Copy link
Contributor Author

eatyourgreens commented Jan 28, 2021

The last attempt to upgrade mobx-react broke classifications for live projects (#1839.) I'm hoping this will avoid that by installing the same version of mobx across the NextJS apps and the classifier.

@eatyourgreens
Copy link
Contributor Author

I'm not seeing a recurrence of #1839 when I submit empty classifications on this branch.
http://local.zooniverse.org:3000/projects/nora-dot-eisner/planet-hunters-tess/classify/workflow/11235?demo=true

@eatyourgreens eatyourgreens requested review from srallen and a team January 29, 2021 09:26
@eatyourgreens eatyourgreens added dependencies Pull requests that update a dependency file enhancement New feature or request labels Jan 29, 2021
@eatyourgreens
Copy link
Contributor Author

Should we upgrade mobx from 5 to 6? Migration guide.

@eatyourgreens eatyourgreens changed the title Upgrade mobx and mobx-react Upgrade mobx, mobx-react and mobx-state-tree Jan 29, 2021
@eatyourgreens
Copy link
Contributor Author

eatyourgreens commented Jan 29, 2021

UPP store model tests in the classifier are all broken, with mobx-state-tree > 3.15, because they don't wait for the UPP to load before running the expectations. 😞

EDIT: Classification works locally with MST 3.17. so I think the tests are the problem, not the store. The expectations run immediately after the project loads, but should wait for the user and UPP to load. This might be fixed by using mobx.when to run the tests.

@eatyourgreens eatyourgreens mentioned this pull request Jan 29, 2021
18 tasks
@eatyourgreens eatyourgreens force-pushed the upgrade-mobx-react branch 2 times, most recently from 2cdf2c2 to 72cf8bd Compare February 1, 2021 10:22
Update the NextJS apps and the classifier to each use [email protected] and [email protected]
Bump mobx-react to 6.3 and mobx-state-tree to 3.17 for the NextJS apps. Upgrading the classifier breaks the tests for the store models, so I've held off on that.
return rootStore.userProjectPreferences.loadingState === asyncStates.success
}
when(
preferencesAreLoaded,
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 delays running the tests until preferencesAreLoaded() is true.

Move duplicated code into a function. Run tests after the UPP has either loaded or errored, then check that the expected state is set.
Copy link
Member

@shaunanoordin shaunanoordin left a comment

Choose a reason for hiding this comment

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

PR Review

Projects: app-project lib-classifier app-content-pages

This PR is a major dependency update for our app's stores.

Testing

Part 1: Tested app-project on macOS10+Chrome88 on localhost:3000

Looking good:

  • With a workflow with 1 Single Question Task, I'm able to...
    • ...answer one question and submit.
    • ...provide no answer and submit
  • With a workflow with 2 Single Question Tasks, I'm able to...
    • ...answer two questions and submit.
    • ...answer one of the questions and submit.
    • ...provide no answer and submit
    • ...go back to a previous question to amend an answer
  • With a workflow with 1 Drawing Task (Point tool, Point tool), I'm able to...
    • ...add, edit, and delete Point marks.
    • ...provide no marks and submit.
    • ...provide 1-5 marks and submit.
  • With a workflow with 1 Drawing Task (Point tool, Point tool), and 1 Text Task, I'm able to...
    • ...add, edit, and delete Point marks.
    • ...proceed to the Text Task, then go back to the Drawing Task to amend my earlier annotations.
      • ⚠️ [minor quirk] there's an oddity where going back to a previous drawing task causes the previous annotations to STILL appear as untouchable "previous marks", but this is extant even in master and not related to this PR. Probably a different bug to fix.
    • ...provide any combination of answer/non-answers and submit

Additional testing on Safari12 and Win+Edge88 (but Edge is basically Chrome in a fancy hat at this moment so no surprise that there are no surprises here.)

Part 2: Tested lib-classifier on local.zooniverse.org:8080

  • Basic tests for lib-classifier looks fine.
  • Based on passing tests in Part 1, I did not feel the need to test the lib-classifier alone too thoroughly.

Part 3: Tested app-content-pages on macOS10+Chrome88 on localhost:3000

  • Content pages loaded fine and functioned normally.

Testing Limitations

  • I'm unable to test authentication/login on app-project on Chrome due to issues accessing https://local.zooniverse.org:3000 on my end. (Chrome spews SSL errors for my pseudo-localhost)
    • On Safari (which is far more permissive with SSL infractions), however, I can confirm that auth/login works fine, for what that's worth.

Status

This PR looks good to me. 👍

@github-actions github-actions bot added the approved This PR is approved for merging label Feb 1, 2021
@shaunanoordin
Copy link
Member

⚠️ [minor quirk] there's an oddity where going back to a previous drawing task causes the previous annotations to STILL appear as untouchable "previous marks", but this is extant even in master and not related to this PR. Probably a different bug to fix.

I just realised you opened #2011 precisely for this. Reviewing that now!

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 dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants