Skip to content

Commit

Permalink
Fetch only the default reports on policy creation
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-marcellini committed Jan 20, 2022
1 parent a083ff8 commit 8773bce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 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

0 comments on commit 8773bce

Please sign in to comment.