-
Notifications
You must be signed in to change notification settings - Fork 75
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
refactor: unify storage/providers (for further InMemory storage integration) [1/3] #475
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? 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to use lodash, or can it just be an empty arrow function like init: () => {}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that's interesting. OK, it's probably fine to leave it as NOOP
for now. Thanks for trying!
@@ -1563,6 +1563,16 @@ function init({ | |||
shouldSyncMultipleInstances = Boolean(global.localStorage), | |||
debugSetState = false, | |||
} = {}) { | |||
Storage.init(); | |||
|
|||
if (shouldSyncMultipleInstances) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
Storage
layer (in future this layer will intercept errors and will substitute provider to InMemory);InstanceSync
class/object - such approach allows us to avoid code duplication if we addInMemory
provider on web;init
method);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 Issues
section aboveTests
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop