-
Notifications
You must be signed in to change notification settings - Fork 64
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
make rootModel setSession check and attempt to remove undefined MST refs #1353
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1353 +/- ##
==========================================
+ Coverage 59.53% 59.65% +0.12%
==========================================
Files 418 418
Lines 18674 18709 +35
Branches 4384 4393 +9
==========================================
+ Hits 11117 11161 +44
+ Misses 7271 7262 -9
Partials 286 286
Continue to review full report at Codecov.
|
Looks good to me, it passes the test for loading a track that is undefined at the least! |
There was this idea where configReference could use a safeReference and that would ideally have a similar behavior, and I can't remember why this doesn't end up working |
( safereference has the nice behavior of "removing itself from array or map" similar to this pr https://mobx-state-tree.js.org/concepts/references) but ya, I had tried to make that change at one point and it just didn't really work |
Attempts to filter out undefined references in sessions at load time as much as possible. It can't get everything, but it does validate all the references at the time that you set the session, so at least you can handle the undefined ref at session load time.
Adds logic in Loader.tsx to handle the new undefined ref errors thrown setSession, which is what actually addresses the problem in #1275.
this is an alternate approach to #1275, but they might possibly be able to work together, could consider testing that.