Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
check if reports data is up to date before update last read action id #6095
check if reports data is up to date before update last read action id #6095
Changes from 4 commits
5dd71c1
bed6ebc
78f3cb4
ccf2684
8c90fab
74bb201
462418d
800160d
e887eaa
ad63b8c
eac3653
411428b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This is not really telling us whether report data is up to date, but whether initial report fetching is over.
The return value will stay
true
ever sinceWithout a server check we can't reliably know whether we're up to date, we can only guess that we're not
To know whether we're synced we should at least check
Then, yes we're probably up to date
IMO the variable should be renamed to
isReportDataLoading
orisReportDataLoaded
and should be updated at the start of the load and at then end, similarly to howfetchActionsWithLoadingState
worksIf that's the case we might also put in in ONYXKEYS e.g.
isReportDataLoading
and then subscribe theReportActionsView
to that keyThere 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. It's a better solution to use a more generic approach like this. I added a new ONYX KEY called
IS_LOADING_REPORT_DATA
. I chose that name to keep it the same way the existing loading keys.This key is set in the
fetchAllReports
function and it updates the variable called ´isReportDataLoading´ in the Report.js. It is not necessary to subscribe the view to that key, because I moved theif
statement inside theupdateLastReadID
like you suggestedThere 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.
It might be better to move this check inside
updateLastReadActionID
There are other places that could call
updateLastReadActionID
while data is still being fetchThere 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.
Done