(dispatch: Dispatch<ImporterAction>)
| 205 | ]); |
| 206 | |
| 207 | public async dispatchChange(dispatch: Dispatch<ImporterAction>) { |
| 208 | const shouldValidate = this.buildSteps.some((step) => |
| 209 | InnerStateBuilder.actionTypesThatRequireValidation.has(step.type) |
| 210 | ); |
| 211 | |
| 212 | const runId = generateValidationRunId(); |
| 213 | |
| 214 | if (shouldValidate) { |
| 215 | dispatch({ type: 'VALIDATION_STARTED', payload: { runId } }); |
| 216 | } |
| 217 | |
| 218 | this.buildSteps.forEach((step) => { |
| 219 | dispatch(step); |
| 220 | }); |
| 221 | |
| 222 | if (shouldValidate) { |
| 223 | const finalState = await this.getState(); |
| 224 | dispatch({ |
| 225 | type: 'VALIDATION_COMPLETED', |
| 226 | payload: { errors: finalState.validationErrors, runId }, |
| 227 | }); |
| 228 | } |
| 229 | } |
| 230 | } |
no test coverage detected