-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Migrate mobx to zustand #583
base: master
Are you sure you want to change the base?
Migrate mobx to zustand #583
Conversation
d7d441a
to
5da37f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that as I have been developing this I disocvered a bug unrelated to this code change.
In iOS simulator, switching servers causes a logout, even if both servers are logged in. Bug is present on current master
branch.
dd1ea2e
to
17e18fb
Compare
…store setups to use `_get` and `_set` for future prep
Question, btw: What is the process for an updated version of the app to be built and released to the app stores (particularly iOS) -- the current version is 1.5.0 and is two years old. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #583 +/- ##
==========================================
- Coverage 60.10% 58.68% -1.43%
==========================================
Files 47 47
Lines 945 973 +28
Branches 189 198 +9
==========================================
+ Hits 568 571 +3
- Misses 342 365 +23
- Partials 35 37 +2 ☔ View full report in Codecov by Sentry. |
How much does this report matter for getting things merged? The code I changed was more just getting the state references updated, I suspect the coverage for these was roughly at these numbers before I touched anything. |
…tive or something similar -- this only happens in ts files
Well... this is in progress. We are working on setting up GitHub Actions to build and publish to TestFlight. Previously we used Expo's legacy build service to build and then manually upload. We have been more or less blocked from publishing new releases since the legacy build service was discontinued. |
It's probably fine 👍 |
Understandable; Do you need any help with this? |
I don't think so... at least for now the main thing is getting some secrets added to the repo (there have been some other more pressing issues Anthony has been dealing with so this is understandably taking some time) then we can iterate on the action until we get a working build. We have been able to reference Swiftfin so hopefully it will be pretty straightforward once the secrets are available. |
Quality Gate passedIssues Measures |
Overview
use<Store>Store()
call (such asuseDownloadStore()
vs. anew StoreClass()
calluseStores()
has been preserved for convenience and refactoringjsdom
environment if they manipulate stateset()
function added to all that allows you to set any property in state; logical setters (e.g.addSever()
) have been preservedBackground
mobx is currently blocking an upgrade to Expo 51 & React 18. See PR #539. @thornbill suggested zustand as a reasonable replacement. This PR resolves issue #564 .
Implementation
Zustand is functional (vs. mobx's class-based code). Essentially, instances of
StoreClass
have been replaced withuseStore()
calls instead. The stores have been broken out into their individual components, which are serialized and stored separately inAsyncStore
, persisted by zustand middleware into the same (already in use)AsyncStorage
State Storage
To access state, use the
use<Store>Store()
method from the correct store's module (e.g.useDownloadStore()
.Test Development
jsdom
environment to be establishedact(() => {<state change here>})
call (you'll see this in most store test suites)Merging
While I normally don't like squash merges, I think that it's the right call here since this is essentially one wholesale sweep of changes that convert from mobx to zustand. If the package maintainers object, I'm happy to try to rewrite my commit history to be more concise, though I think that's probably not the right call personally.