-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: make consistent behavior of displaying green line for assign task #51174
Changes from all commits
3afe1b8
326332e
6054ad5
42d4444
ce5f2f6
7447a12
a8cc00e
f3968e6
320df1c
597886a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; | |
import DateUtils from '@libs/DateUtils'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import * as ReportActionsUtils from '@libs/ReportActionsUtils'; | ||
import * as ReportConnection from '@libs/ReportConnection'; | ||
import * as ReportUtils from '@libs/ReportUtils'; | ||
import Visibility from '@libs/Visibility'; | ||
import type {AuthScreensParamList} from '@navigation/types'; | ||
|
@@ -210,6 +211,10 @@ function ReportActionsList({ | |
); | ||
const prevSortedVisibleReportActionsObjects = usePrevious(sortedVisibleReportActionsObjects); | ||
|
||
const reportLastReadTime = useMemo(() => { | ||
return ReportConnection.getReport(report.reportID)?.lastReadTime ?? report.lastReadTime ?? ''; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should never use |
||
}, [report.reportID, report.lastReadTime]); | ||
|
||
/** | ||
daledah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The timestamp for the unread marker. | ||
* | ||
|
@@ -218,9 +223,9 @@ function ReportActionsList({ | |
* - marks a message as read/unread | ||
* - reads a new message as it is received | ||
*/ | ||
const [unreadMarkerTime, setUnreadMarkerTime] = useState(report.lastReadTime ?? ''); | ||
const [unreadMarkerTime, setUnreadMarkerTime] = useState(reportLastReadTime); | ||
useEffect(() => { | ||
setUnreadMarkerTime(report.lastReadTime ?? ''); | ||
setUnreadMarkerTime(reportLastReadTime); | ||
|
||
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps | ||
}, [report.reportID]); | ||
Comment on lines
+226
to
231
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Causes this issue: #53000 More details: #53000 (comment) |
||
|
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.
Please remove this function. Any data in Onyx that needs to be updated should be done via one of the proper Onyx methods (merge, set, etc.).
This method will introduce bad side-effects which could have unknown consequences and lead to many bugs without the ability to track them down.
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.
Context https://expensify.slack.com/archives/C01GTK53T8Q/p1732889804245739
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.
FYI I'm working on the PR where
ReportConnection
file is removed. ThereupdateReportData
function usage is replaced withOnyx.merge
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.
Just to confirm, @stitesExpensify was there any specific reason why you created this function instead of using
Onyx.merge
?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.
To clarify, this was written by @daledah I was just the reviewer, so I'll leave that answer to him
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.
As I said in the proposal.
createTaskAndNavigate
will updatelastReadTime
ascurrentTime
. After that we dismiss modal and navigate to report:App/src/libs/actions/Task.ts
Line 304 in ce23fb5
lastReadTime
here:App/src/libs/actions/Report.ts
Line 955 in e9de4f2
App/src/pages/home/report/ReportActionsList.tsx
Line 209 in e9de4f2
That’s the reason we decided to use getReport to get the up-to-date data.
I think we can’t use useOnyx in this case since its value can be outdated in this case. Please forgive me If I did something wrong, I’ll raise other PR to fix If we have the better idea.
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.
@daledah Can you remove your change and test the original issue? I think it's fixed somewhere else.