Last synced just now does not update#41310
Last synced just now does not update#41310mountiny merged 13 commits intoExpensify:qbo-freeze-branchfrom
Conversation
|
@tienifr Getting an error on the PolicyAccountingPage, also we have a lint (prettier) error. |
|
@aldo-expensify @mountiny @Ollyws Here's the data returned from BE. The date format is not correct, it should be |
|
@mountiny can you help take a look? |
t doesn't look incorrect to me, isn't that an ISO date string? We want to avoid changes in the backend that could cause problems with OldDot |
|
@Ollyws I fixed the PR |
| useEffect(() => { | ||
| const locale = preferredLocale ?? CONST.LOCALES.DEFAULT; | ||
| setDateTimeToRelative(DateUtils.datetimeToRelative(locale, formatedDate)); | ||
| const interval = setInterval(() => { |
There was a problem hiding this comment.
Why do we need to use setInterval here?
There was a problem hiding this comment.
If we don't use setInterval, we have to refresh page to see the new relativeTime
There was a problem hiding this comment.
Wouldn't any change in formattedDate trigger the useEffect though?
There was a problem hiding this comment.
I agree with Olly, shouldn't this already be handled by the useEffect dependency?
There was a problem hiding this comment.
@tienifr i dont think this is a requirement @trjExpensify i think its fine to not update the sync date until we get pusher update or user navigates away and back to the page.
I dont think there is much value in having the text auto update when user stays on the page
There was a problem hiding this comment.
Yeah, agreed. Pretty sure with OldDot we do that too.
|
Agree with Aldo, that seems correct to me, lets try to work with this format returned by BE |
| useEffect(() => { | ||
| const locale = preferredLocale ?? CONST.LOCALES.DEFAULT; | ||
| setDateTimeToRelative(DateUtils.datetimeToRelative(locale, formatedDate)); | ||
| const interval = setInterval(() => { |
There was a problem hiding this comment.
I agree with Olly, shouldn't this already be handled by the useEffect dependency?
@mountiny @Ollyws I thought it was not updated in real time, that why I added the setInterval logic to trigger updating relativeTime. I need to test this API again to see if Screen.Recording.2024-05-09.at.10.13.28.mov |
|
@tienifr the route is incorrect, there should not be |
|
@tienifr Just manually update the domain part to dev.new.expensify.com:8082 |
|
@mountiny If we don't use |
|
@tienifr Ahh I see what you're saying, |
|
@tienifr when I change my timezone I get an incorrect time calculation: |
web-resize.mp4@Ollyws It worked well on my side, can you pls elaborate? |
|
@tienifr The text in your video is saying that it last synced "in about 2 hours" which is in the future. |
|
@Ollyws Ah I see that bug. The RCA is here Line 135 in f443efa we use I think using |
mountiny
left a comment
There was a problem hiding this comment.
I think we should remove the set interval
|
@tienifr Requested one change and lint is failing |
|
@mountiny I removed setInterval and fixed lint |
|
Removing the setInterval will stop the last synced label from updating, for example it will say |
This is not right though. It should change with each re-render or change of the last sync value that comes in through pusher. So if user navigated away in the app and comes back to the accounting page, they will see different time. Essentially the only flow the setInterval would be fixing is that admin will sync the connection and remains on the page for a while and the value will not update on its own. I think however this is pre-optimization and admins will not really hang on that page waiting for the text to update, they can navigate away and back to see the timestamp update. So I think we can move ahead @Ollyws can you complete the review please? |
Reviewer Checklist
Screenshots/VideosAndroid: Native01_Android_Native.mp4Android: mWeb Chrome02_Android_Chrome.mp4iOS: Native03_iOS_Native.mp4iOS: mWeb Safari04_iOS_Safari.mp4MacOS: Chrome / Safari05_MacOS_Chrome.mp4MacOS: Desktop06_MacOS_Desktop.mp4 |
Ollyws
left a comment
There was a problem hiding this comment.
If that's the expected behaviour then we're good to go.
Just to re-iterate the last synced label will only be updated when the user either navigates away from the page and back again, or refreshes.
@tienifr Could you update the testing steps to align with this? Thanks.
|
@Ollyws I updated |
mountiny
left a comment
There was a problem hiding this comment.
Thanks for testing thoroughly, waiting for the merge freeze to be lifted
|
@mountiny @hayata-suenaga @tienifr let's change this over to the QBO freeze branch and merge it |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.79-11 🚀
|





Details
Fixed Issues
$ #41045
PROPOSAL: #41045 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.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