ctrlplusb / easy-peasy

Vegetarian friendly state for React
https://easy-peasy.dev
MIT License
5.03k stars 190 forks source link

bugfix: persist not working on iOS #836

Closed jmyrland closed 1 year ago

jmyrland commented 1 year ago

createPersistor defines a timingMethod that won't work on iOS.

~This is because this method utilizes requestIdleCallback, which is defined on iOS - but never invoked 🤯~

~So, for iOS we have to fallback to utilize requestAnimationFrame. This is done by vendoring a specific file timingMethod.ios.js, which the RN bundle can import for the iOS platform.~

It turns out that the pollyfilled requestIdleCallback for RN on iOS, requires a second parameter with a specific timeout - where as the native implementation does not. Setting the specific parameter invokes this function across all platforms.

fixes #694 fixes #599

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
easy-peasy ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2023 2:28pm
jmyrland commented 1 year ago

I'm not able to verify if this is working, as I currently don't have a mac to test this on :/

jmyrland commented 1 year ago

Verified and tested on https://snack.expo.dev/_fo68oUf7

Notice how SET_ITEM is logged for all platforms.