-
Notifications
You must be signed in to change notification settings - Fork 642
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
onInvalidated not Called when Bad Reference Hits Store - App Crashes - React Native Expo #2212
Comments
I ran across a similar issue here: #1509 And I wholeheartedly agree with @jamonholmgren's comment! |
Hi @ChristopherGabba - thanks for the bug report and I'm sorry for all the frustration. For what it's worth, I agree that this is a poorly documented part of the codebase, and it's harder than it has to be. I agree with Jamon that we should solve this at a library level. I am happy to keep this open along with the other issue, and we'll continue to consider how to build a feature that does what you (and many other people) expect. But I do want to bring up my comment from that thread: #1509 (comment) Strictly speaking, the behavior is working as intended. I'm not certain if it will make sense to change I think the main problem here is the naming and documentation of this feature makes it seem like it's going to do something very different from what it does in actuality. A The I don't say that to dismiss the concern. Just to clarify for anyone else who ends up here. But still, I hear you (and many other folks), that this is a painful experience. I don't have a great estimate on when this will be fixed, or how. If you're very motivated to have a better experience, I'd be very happy to help you get set up to contribute to the codebase, and I always prioritize community contributions for code review. Could be a fun way to work together to resolve a longstanding pain point! If that's interesting to you, email me at tyler (at) coolsoftware.dev and I'd even be down to schedule a video call to onboard you. If you don't have the time or interest, we'll just keep you updated here if and when we get around to figuring this out. Have a great weekend! |
@coolsoftwaretyler Sorry for the delayed response, I was on vacation for quite a while... I would be glad to help, although I am definitely not an "Expert" programmer by any stretch. Here is my thoughts:
Doing all of the above would make this whole API make sense, handle all the error cases, and provide the user with a way to handle either situation. Curious as to your thoughts on the path mentioned above? |
Hey @ChristopherGabba - all good! No need to be an expert programmer at all. If you're energized about this, all it really takes is some time and follow-through. I think you've got a good start here, but I'd like to reframe the direction a little, primarily to avoid breaking changes, which will allow us to move more quickly and get feedback from other users. Here's my response to your items, and then a recommendation from my side of things. Response to the proposal
Next stepsOk, so if you're still down to work on this, I'd love to focus on the
After that, we'll see how the community responds, and identify any new changes to make afterwards (like improving the If it sounds good, I'll keep an eye out for your email. Have a great day! |
Bug report
Sandbox link or minimal reproduction code
npx eas build --profile development --platform ios
npx expo install -c
in terminalSign in
Podcasts
Tab at the bottomToggle Favorite
button for any podcast. I hard coded this:with this:
Describe the expected behavior
I would expect the
onInvalidated
hook to call and remove the bad reference immediately instead of crashing the app.I've SEVERELY struggled with this behavior with MST with regard to references, and that's why I migrated to
safeReference
so that it wouldn't crash. The app should not crash when a bad reference arrives, it should handle gracefully (aka hit the invalidated function call).Real Life Scenario:
Describe the observed behavior
The app crashes immediately.
You'll notice after you add the bad reference, the app is stuck in an eternal cycle of instant crashes because the bad reference is just stuck in the store, and it forces the dev to have to clear the store. When you have about 10 reference situations in an app like mine, that is so annoying to have to do.
In my app, what I've had to do is:
And I do not enjoy having to do this, and frankly feel as though I shouldn't have to if the
onInvalidated
function was working correctly. If a reference is bad from the backend, you have to send something to modify the backend to make sure it doesn't just keep hitting the client with a bad reference over and over again, and theonInvalidated
hook was where I handle this..There has to be a better way of dealing with this.
As always, thanks so much for looking into this, I love MST (minus the reference stuff) :)
The text was updated successfully, but these errors were encountered: