-
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: deleted workspace room display in task share somewhere #41636
Changes from all commits
2fc6f72
4e00bd6
3bbf651
a7a0f2b
8fda27f
c7f128b
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 |
---|---|---|
|
@@ -64,22 +64,11 @@ function OptionsListContextProvider({reports, children}: OptionsListProviderProp | |
return; | ||
} | ||
|
||
const lastUpdatedReport = ReportUtils.getLastUpdatedReport(); | ||
|
||
if (!lastUpdatedReport) { | ||
return; | ||
} | ||
|
||
const newOption = OptionsListUtils.createOptionFromReport(lastUpdatedReport, personalDetails); | ||
const replaceIndex = options.reports.findIndex((option) => option.reportID === lastUpdatedReport.reportID); | ||
|
||
if (replaceIndex === -1) { | ||
return; | ||
} | ||
const newReports = OptionsListUtils.createOptionList({}, reports).reports; | ||
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. Generating the whole optionList whenever any report changes looks inefficient. Can we just update the last three or five updated reports? 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. Updated. Deleting workspace is too buggy for me. I couldn't delete one. Even if so, the 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. I am sorry. I see that there can be many policy expense chats of other invited members as well. So just deleting 5 reports might not suffice because the other reports still appear in the results. deleteFiveReports.mp4There 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. Reverted! 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. Why we are passing empty object for the personal details? The personal details are used to get the correct icons. This is causing #42232. While testing I also found that the list becomes irresponsive and get into infinite loop (could be related to change here too?) |
||
|
||
setOptions((prevOptions) => { | ||
const newOptions = {...prevOptions}; | ||
newOptions.reports[replaceIndex] = newOption; | ||
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. Just wanted to note that the old code was mutating data here which is pretty bad in React. |
||
newOptions.reports = newReports; | ||
return newOptions; | ||
}); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
|
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.
Removing the return early when no existing item need to update allow this
useEffect
to handle adding the new items which should handle in the next useEffect that lead to duplicated new items in the list, and it handled here #43094