diff --git a/lib/reducers/report-store-reducer.js b/lib/reducers/report-store-reducer.js --- a/lib/reducers/report-store-reducer.js +++ b/lib/reducers/report-store-reducer.js @@ -131,15 +131,24 @@ }; } else if (action.type === queueReportsActionType) { const { reports } = action.payload; - const filteredReports = [...updatedReports, ...reports].filter(report => + const filteredReports = reports.filter(report => isReportEnabled(report, state.enabledReports), ); + + const reportStoreOperations: $ReadOnlyArray = + convertReportsToReplaceReportOps([...newReports, ...filteredReports]); + + const queuedReports = processReportStoreOperations( + state.queuedReports, + reportStoreOperations, + ); + return { reportStore: { ...state, - queuedReports: filteredReports, + queuedReports, }, - reportStoreOperations: [], + reportStoreOperations, }; } const reportStore = diff --git a/lib/reducers/report-store-reducer.test.js b/lib/reducers/report-store-reducer.test.js --- a/lib/reducers/report-store-reducer.test.js +++ b/lib/reducers/report-store-reducer.test.js @@ -208,7 +208,10 @@ const action = { type: 'QUEUE_REPORTS', payload: { - reports: [mockErrorReport], + reports: [ + { ...mockErrorReport, id: 'new-1' }, + { ...mockInconsistencyReport, id: 'new-2' }, + ], }, }; const reportStore = { @@ -220,8 +223,8 @@ }, }; const { reportStore: result } = reduceReportStore(reportStore, action, [ - mockErrorReport, - mockInconsistencyReport, + { ...mockErrorReport, id: 'new-3' }, + { ...mockInconsistencyReport, id: 'new-4' }, ]); expect(result.queuedReports).toHaveLength(3); const enabledReports = result.queuedReports.filter(