Skip to content

Commit

Permalink
Fix saga error
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Oct 29, 2019
1 parent f0b6560 commit 4b03ff5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixes [#2435](https://github.com/microsoft/BotFramework-WebChat/issues/2435). Fix microphone button getting stuck on voice-triggered expecting input hint without a speech synthesis engine, by [@compulim](https://github.com/compulim) in PR [#2445](https://github.com/microsoft/BotFramework-WebChat/pull/2445)
- Fixes [#2472](https://github.com/microsoft/BotFramework-WebChat/issues/2472). Update samples to use repo's version of React, by [@corinagum](https://github.com/corinagum) in PR [#2478](https://github.com/microsoft/BotFramework-WebChat/pull/2478)
- Fixes [#2473](https://github.com/microsoft/BotFramework-WebChat/issues/2473). Fix samples 13 using wrong region for Speech Services credentials, by [@compulim](https://github.com/compulim) in PR [#2482](https://github.com/microsoft/BotFramework-WebChat/pull/2482)
- Fixes [#2420](https://github.com/microsoft/BotFramework-WebChat/issues/2420). Fix saga error should not result in an unhandled exception, by [@compulim](https://github.com/compulim) in PR [#2421](https://github.com/microsoft/BotFramework-WebChat/pull/2421)

### Added

Expand Down
72 changes: 37 additions & 35 deletions packages/core/src/reducers/connectivityStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,43 @@ import { SAGA_ERROR } from '../actions/sagaError';
const DEFAULT_STATE = 'uninitialized';

export default function connectivityStatus(state = DEFAULT_STATE, { type, meta }) {
switch (type) {
case CONNECT_PENDING:
case RECONNECT_PENDING:
if (state !== 'uninitialized') {
state = 'reconnecting';
}

break;

case CONNECT_FULFILLED:
state = 'connected';
break;

case RECONNECT_FULFILLED:
state = 'reconnected';
break;

case CONNECT_REJECTED:
state = 'error';
break;

case CONNECT_STILL_PENDING:
state = 'connectingslow';
break;

case DISCONNECT_FULFILLED:
state = meta.error ? 'error' : 'notconnected';
break;

case SAGA_ERROR:
state = 'sagaerror';
break;

default:
break;
if (state !== 'sagaerror') {
switch (type) {
case CONNECT_PENDING:
case RECONNECT_PENDING:
if (state !== 'uninitialized') {
state = 'reconnecting';
}

break;

case CONNECT_FULFILLED:
state = 'connected';
break;

case RECONNECT_FULFILLED:
state = 'reconnected';
break;

case CONNECT_REJECTED:
state = 'error';
break;

case CONNECT_STILL_PENDING:
state = 'connectingslow';
break;

case DISCONNECT_FULFILLED:
state = meta && meta.error ? 'error' : 'notconnected';
break;

case SAGA_ERROR:
state = 'sagaerror';
break;

default:
break;
}
}

return state;
Expand Down

0 comments on commit 4b03ff5

Please sign in to comment.