-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Last synced just now does not update #41310
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to use setInterval here?
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.
If we don't use setInterval, we have to refresh page to see the new relativeTime
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.
Wouldn't any change in formattedDate
trigger the useEffect though?
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 agree with Olly, shouldn't this already be handled by the useEffect dependency?
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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 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 |
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.
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 |
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 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop