Expensify / react-native-onyx

Persistent, offline-first state management solution for React Native. Easy to use with minimal config and boilerplate.
MIT License
151 stars 71 forks source link

Add some basic runtime type validation in Onyx #532

Closed dominictb closed 4 months ago

dominictb commented 5 months ago

Details

Add some basic runtime type validation in Onyx for merge, set and mergeCollection operation

Related Issues

https://github.com/Expensify/App/issues/39852

Automated Tests

Test 1: For set operation: https://github.com/Expensify/react-native-onyx/blob/9ee724140cf4d78ce8d298545fa8445067a4f192/tests/unit/onyxTest.js#L75

Test 2: For merge operation: https://github.com/Expensify/react-native-onyx/blob/9ee724140cf4d78ce8d298545fa8445067a4f192/tests/unit/onyxTest.js#L117

Test 3: For mergeCollection: https://github.com/Expensify/react-native-onyx/blob/9ee724140cf4d78ce8d298545fa8445067a4f192/tests/unit/onyxTest.js#L434

Manual Tests

N/A

Author Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/react-native-onyx/assets/165644294/e4737868-d9c4-4b8c-af18-21bdea418e02
Android: mWeb Chrome https://github.com/Expensify/react-native-onyx/assets/165644294/c04b147e-6a0f-496d-a18b-b08481b31588
iOS: Native https://github.com/Expensify/react-native-onyx/assets/165644294/a66c1482-1055-462c-874d-04052165d646
iOS: mWeb Safari https://github.com/Expensify/react-native-onyx/assets/165644294/177737b9-d955-4080-9242-5736bb248995
MacOS: Chrome / Safari https://github.com/Expensify/react-native-onyx/assets/165644294/31101ff4-ebb1-4c66-8441-41f31b414e18
MacOS: Desktop https://github.com/Expensify/react-native-onyx/assets/165644294/efd979e6-4840-4796-860b-77b94afad16c
github-actions[bot] commented 5 months ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

dominictb commented 5 months ago

I have read the CLA Document and I hereby sign the CLA

dominictb commented 5 months ago

recheck

AndrewGable commented 5 months ago

Assigned reviewers of https://github.com/Expensify/App/issues/39852

dominictb commented 4 months ago

@dominictb please complete the author checklist and perform some basic manual testing of this PR with a local build of E/App using these changes.

Will do it as soon as possible. Thanks. Feels free to review the rest of the PR

mananjadhav commented 4 months ago

Reviewed it once, going through once again.

dominictb commented 4 months ago

LGTM, pending one confirmation.

@roryabraham Do we do a checklist here? or when we bump the App PR with updated Onyx version?

@mananjadhav some videos are uploaded in the PR description (local build). Feel free to check.

mananjadhav commented 4 months ago

Thanks @dominictb I did check those.

roryabraham commented 4 months ago

Do we do a checklist here?

We should do a checklist here with a build of react-native-onyx linked against E/App dev. See instructions in the README on how to do this.

dominictb commented 4 months ago

uh oh, @mananjadhav anything I need to do to complete the PR? Thanks!

mananjadhav commented 4 months ago

No. I'll finish this checklist today.

mananjadhav commented 4 months ago

Reviewer Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/react-native-onyx/assets/3069065/399150c0-40d8-473e-9ffc-fc182301d298
Android: mWeb Chrome https://github.com/Expensify/react-native-onyx/assets/3069065/d1e1ccd4-e337-468a-9662-944c8a256f2a
iOS: Native https://github.com/Expensify/react-native-onyx/assets/3069065/8c5f68a5-f1cb-43ae-8b88-63dfd20cb955
iOS: mWeb Safari https://github.com/Expensify/react-native-onyx/assets/3069065/f36f2450-4536-4873-bcd0-66f34bb25633
MacOS: Chrome / Safari https://github.com/Expensify/react-native-onyx/assets/3069065/156baa57-eda2-4651-a6db-3c2bfa8429b4 web-data-mismatch-4 web-data-mismatch-3 web-data-mismatch-2 web-data-mismatch-1
MacOS: Desktop https://github.com/Expensify/react-native-onyx/assets/3069065/944e9743-949d-49ac-8aa1-5b0a8969a9ef
mananjadhav commented 4 months ago

@roryabraham All yours.

roryabraham commented 4 months ago

looks like reassure is just not set up correctly in Onyx?

dominictb commented 4 months ago

@roryabraham I merged main. Can u check?

mananjadhav commented 4 months ago

@roryabraham Can you action the PR so that the workflows are executed?

dominictb commented 4 months ago

@roryabraham @mananjadhav let's merge this so I can bump the version in Expensify/App

dominictb commented 4 months ago

@roryabraham @mananjadhav any update before we can merge?

roryabraham commented 4 months ago

sorry for the delay. As this is your first PR in this repo I have to manually approve workflows to run, so that's why it was delayed.

github-actions[bot] commented 4 months ago

🚀Published to npm in v2.0.35