refactor: unify storage/providers (for further InMemory storage integration) [1/3]#475
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
29cd54c to
b83cc07
Compare
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
|
Adding original reviewers from #439 |
|
@tgolen I addressed your notes - would you mind to check this PR again? 👀 |
tgolen
left a comment
There was a problem hiding this comment.
Gotcha, I see what you did now! I like it.
| * On native platforms, we omit this syncing logic by setting this to mock implementation. | ||
| */ | ||
| const InstanceSync = { | ||
| init: NOOP, |
There was a problem hiding this comment.
Does this need to use lodash, or can it just be an empty arrow function like init: () => {}?
There was a problem hiding this comment.
@tgolen if I add empty functions I'm getting eslint errors:
Do you think it would be better to specify our own function?
There was a problem hiding this comment.
Hm, that's interesting. OK, it's probably fine to leave it as NOOP for now. Thanks for trying!
| } = {}) { | ||
| Storage.init(); | ||
|
|
||
| if (shouldSyncMultipleInstances) { |
There was a problem hiding this comment.
Was there any specific reason to move this up here? I think it makes sense but I'm also surprised that it wasn't here to begin with.
There was a problem hiding this comment.
@tgolen it was already asked in #439 (comment)
And I agree, that it's better to keep initialization in a single place 👀
|
Got some competing priorities so will have to pull myself off the review to avoid becoming a blocker. If there is anything that needs my attention I am happy to take a look! |
|
Looks like you'll need to run prettier on this branch to get the lint test to pass. |
danieldoglas
left a comment
There was a problem hiding this comment.
Changes LGTM based on what I've read in the description. Please assign me on the next PR as well so I can get more context.
1932e25 to
1bfc24d
Compare
My bad 🤦♂️ I signed them now and pushed to this PR (hopefully now everything is okay and it can be merged 😊) |
|
@tgolen is there any other blockers preventing this PR from being merged? |
This reverts commit 577e611.
This reverts commit 577e611.
This reverts commit 577e611.
This reverts commit 577e611.

Details
A follow up for #439
This is the first PR that prepares an "infrastructure" for next PR. In this PR I did:
Storagelayer (in future this layer will intercept errors and will substitute provider to InMemory);InstanceSyncclass/object - such approach allows us to avoid code duplication if we addInMemoryprovider on web;initmethod);Related Issues
Expensify/App#29403
Automated Tests
This PR changes the way we use the storage but the functionality of the library to the outer world is the same. Therefore no new tests were added.
Manual Tests
Verify that no flows and functionality were broken by the changes. Check for console errors regarding Onyx.
Author Checklist
### Related Issuessection aboveTestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop