-
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
fix: make consistent behavior of displaying green line for assign task #51174
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3afe1b8
fix: make consistent behavior of displaying green line for assign task
daledah 326332e
fix: typecheck
daledah 6054ad5
fix: update function
daledah 42d4444
Merge branch 'main' into fix/50792
daledah ce5f2f6
Merge branch 'main' into fix/50792
daledah 7447a12
fix: marker appears briefly on ios
daledah a8cc00e
fix: apply suggested changes
daledah f3968e6
fix: change effect deps
daledah 320df1c
fix: keep comment
daledah 597886a
fix: use getReport
daledah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,20 +211,15 @@ function ReportActionsList({ | |
); | ||
const prevSortedVisibleReportActionsObjects = usePrevious(sortedVisibleReportActionsObjects); | ||
|
||
/** | ||
daledah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The timestamp for the unread marker. | ||
* | ||
* This should ONLY be updated when the user | ||
* - switches reports | ||
* - marks a message as read/unread | ||
* - reads a new message as it is received | ||
*/ | ||
const [unreadMarkerTime, setUnreadMarkerTime] = useState(report.lastReadTime ?? ''); | ||
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]); | ||
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]); | ||
}, [reportLastReadTime]); | ||
daledah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const prevUnreadMarkerReportActionID = useRef<string | null>(null); | ||
/** | ||
|
Oops, something went wrong.
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.
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.