diff --git a/client/src/actions/NetworkAction.ts b/client/src/actions/NetworkAction.ts index 84d8b97..3a806e6 100644 --- a/client/src/actions/NetworkAction.ts +++ b/client/src/actions/NetworkAction.ts @@ -69,7 +69,10 @@ export const SERVER_FAILED = "SERVER_FAILED" /** Sent in response to the client's ClientNestedAction, if it fails and has not been applied to the server map. */ export interface ServerFailedAction extends BaseAction { readonly type: typeof SERVER_FAILED - readonly failures: readonly ActionFailure[] + /** The IDs of the failed actions, all of which failed with the same error. */ + readonly ids: readonly number[] + /** The error the above actions failed with. */ + readonly error: string } export function isServerFailedAction(action: AppAction): action is ServerFailedAction { return action.type === SERVER_FAILED diff --git a/client/src/reducers/ServerReducer.ts b/client/src/reducers/ServerReducer.ts index 637cde5..b057a58 100644 --- a/client/src/reducers/ServerReducer.ts +++ b/client/src/reducers/ServerReducer.ts @@ -156,10 +156,10 @@ function serverFailedReducer(oldState: AppState, action: ServerFailedAction): Ap return oldState } const failedIndexes: {[id: number]: boolean|undefined} = {} - for (let index = 0; index < action.failures.length; index += 1) { - failedIndexes[action.failures[index].id] = true + for (let index = 0; index < action.ids.length; index += 1) { + failedIndexes[action.ids[index]] = true } - // TODO: Figure out somewhere to put the failures for logging purposes, so the messages aren't wasted. + // TODO: Figure out somewhere to put the failure message for logging purposes, so the messages aren't wasted. /* const failedActions = */ oldState.network.sentActions.filter((sent) => !!failedIndexes[sent.id]).map((sent) => sent.action) const stillWaitingActions = oldState.network.sentActions.filter((sent) => !failedIndexes[sent.id])