Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ function getOptions(reports, personalDetails, activeReportID, {
const logins = lodashGet(report, ['participants'], []);

// Report data can sometimes be incomplete. If we have no logins or reportID then we will skip this entry.
if (!report || !report.reportID || (_.isEmpty(logins) && !ReportUtils.isChatRoom(report))) {
const shouldFilterNoParticipants = _.isEmpty(logins) && !ReportUtils.isChatRoom(report) && !ReportUtils.isDefaultRoom(report);
if (!report || !report.reportID || shouldFilterNoParticipants) {
return;
}

Expand All @@ -405,7 +406,7 @@ function getOptions(reports, personalDetails, activeReportID, {
: '';

const reportContainsIOUDebt = iouReportOwner && iouReportOwner !== currentUserLogin;
const shouldFilterReportIfEmpty = !showReportsWithNoComments && report.lastMessageTimestamp === 0;
const shouldFilterReportIfEmpty = !showReportsWithNoComments && report.lastMessageTimestamp === 0 && !ReportUtils.isDefaultRoom(report);
const shouldFilterReportIfRead = hideReadReports && report.unreadActionCount === 0;
const shouldFilterReport = shouldFilterReportIfEmpty || shouldFilterReportIfRead;
if (report.reportID !== activeReportID
Expand Down
8 changes: 7 additions & 1 deletion src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as Localize from '../Localize';
import Navigation from '../Navigation/Navigation';
import ROUTES from '../../ROUTES';
import * as OptionsListUtils from '../OptionsListUtils';
import * as Report from './Report';

const allPolicies = {};
Onyx.connect({
Expand Down Expand Up @@ -111,6 +112,9 @@ function create(name = '') {
}
res = response;

// Fetch the default reports on the policy
Report.fetchChatReportsByIDs([response.policy.chatReportIDAdmins, response.policy.chatReportIDAnnounce]);

// We are awaiting this merge so that we can guarantee our policy is available to any React components connected to the policies collection before we navigate to a new route.
return Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${response.policyID}`, {
employeeList: getSimplifiedEmployeeList(response.policy.employeeList),
Expand Down Expand Up @@ -158,7 +162,9 @@ function deletePolicy(policyID) {

// Removing the workspace data from Onyx as well
return Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, null);
}).then(() => {
})
.then(() => Report.fetchAllReports(false, true))
.then(() => {
Navigation.dismissModal();
Navigation.navigate(ROUTES.HOME);
return Promise.resolve();
Expand Down
5 changes: 5 additions & 0 deletions src/pages/home/sidebar/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,10 @@ export default withLocalize(memo(OptionRow, (prevProps, nextProps) => {
return false;
}

// Re-render when the text changes
if (prevProps.option.text !== nextProps.option.text) {
return false;
}

return true;
}));