-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Properly handle previous data formats when saving the updates from the server to Onyx #27180
Conversation
@neil-marcellini Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@@ -35,6 +37,18 @@ export default () => { | |||
return; | |||
} | |||
|
|||
// Since we used the same key that used to store another object, let's confirm that the current object is | |||
// following the new format before we proceed. If it isn't, then let's clear the object in Onyx. |
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.
Any idea how long we have to keep this code here for? We should be able to remove it after about a month or so, right?
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.
I would say 1 week after it reaches production (then we should have 90% of the people using the new version)
Reviewer Checklist
Screenshots/VideosWebMobile Web - ChromeNote: this can only be tested on web/desktop due to access with the console Mobile Web - SafariNote: this can only be tested on web/desktop due to access with the console DesktopiOSNote: this can only be tested on web/desktop due to access with the console AndroidNote: this can only be tested on web/desktop due to access with the console |
I think this PR needs proper tests like setting the previous object type in Onyx from the JS console and verifying the bug doesn't happen. I might be able to add that if I have time today, but I don't think this is super urgent and I have some other stuff that is. |
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.
I think I'm lacking some context around this to fully understand it, but the code looks fine. It would be great to have more of a problem description in the PR description. Please also include tests.
Sounds like Tim is going to take this over? Lmk when it's ready for another review.
// following the new format before we proceed. If it isn't, then let's clear the object in Onyx. | ||
if ( | ||
!_.isObject(val) || | ||
!Object.prototype.hasOwnProperty.call(val, 'type') || |
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.
NAB: We could use _.has
instead since we generally prefer underscore functions.
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.
Thanks, I didn't know that existed. Updated to it
@neil-marcellini @tgolen I've fixed the test steps |
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.
NAB: We usually use import lodashHas from 'lodash/has';
as opposed to using the one from underscore. I think it's fine to use the underscore one here. The function from lodash supports more complex cases like lodashHas(obj, 'a[0].b.c');
@danieldoglas I'm trying to run through the tests before merging this, and I'm having some issues. Here is what I did:
If I look at the JS console, the sequential queue is paused and that's really the last thing that happens |
I did a little debugging and the queue is paused because So, I imagine that is what my problem is, and I have no idea why that would happen. |
I posted to slack here: https://expensify.slack.com/archives/C035J5C9FAP/p1694708298588159?thread_ts=1693594227.145039&cid=C035J5C9FAP If you're able to run through the tests, can you please upload a video or screenshot of it working? |
@tgolen actually there was a problem with the new check, I was using a OR instead of AND. This was fixed! The error with storage in onyx is not related to this PR |
OK, I'm testing it again. I'm not ever getting the log line from step 5. Is there a certain way to trigger it? I tried |
@tgolen, I think I left the instructions a bit confusing. The log will only appear for invalid formats, when you leave it empty it will just ignore it and do nothing because of this check: I've confirmed it will log for other invalid formats. |
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.
Note to self: Next time, we should have done an onyx migration :D I odn't know why I didn't think of it here.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.71-0 🚀
|
@danieldoglas @tgolen Could you help us with step 2 and step 5.
|
Ah, I didn't realize that was only possible to do in local dev environments. I think it's safe to treat this one as [No QA] and you can go ahead and mark it off. |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.71-12 🚀
|
Details
Fixed Issues
$ #27163
Tests
If you're starting a new instance with a new login, the original error won't happen, so you'll need to force it out.
Onyx.set('OnyxUpdatesLastUpdateIDAppliedToClient', null);
in the consoleReconnectApp
in the network tabonyxUpdatesFromServer
exists in Application > IndexedDb > OnyxDB > keyvaluepairsOnyx.set('onyxUpdatesFromServer', {INVALID_FORMAT});
in the console to set that property to an invalid format and confirm it will log[OnyxUpdateManager] Invalid format found for updates, cleaning and unpausing the queue
Onyx.set('onyxUpdatesFromServer', {'type': ''});
Onyx.set('onyxUpdatesFromServer', {'type': 'https'});
Onyx.set('onyxUpdatesFromServer', {'type': 'https', 'request': {}});
Onyx.set('onyxUpdatesFromServer', {'type': 'pusher', 'request': {}, 'response': {}});
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.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
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android