From 83a0988daad0e2bc95b158691792386c2a63ee6a Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 2 May 2022 14:40:34 -0500 Subject: [PATCH] submitReport(): don't call getState() a million times --- app/soapbox/actions/reports.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/soapbox/actions/reports.js b/app/soapbox/actions/reports.js index 69f9006de..8e8e45595 100644 --- a/app/soapbox/actions/reports.js +++ b/app/soapbox/actions/reports.js @@ -56,13 +56,14 @@ export function toggleStatusReport(statusId, checked) { export function submitReport() { return (dispatch, getState) => { dispatch(submitReportRequest()); + const { reports } = getState(); return api(getState).post('/api/v1/reports', { - account_id: getState().getIn(['reports', 'new', 'account_id']), - status_ids: getState().getIn(['reports', 'new', 'status_ids']), - rule_ids: getState().getIn(['reports', 'new', 'rule_ids']), - comment: getState().getIn(['reports', 'new', 'comment']), - forward: getState().getIn(['reports', 'new', 'forward']), + account_id: reports.getIn(['new', 'account_id']), + status_ids: reports.getIn(['new', 'status_ids']), + rule_ids: reports.getIn(['new', 'rule_ids']), + comment: reports.getIn(['new', 'comment']), + forward: reports.getIn(['new', 'forward']), }); }; }