Releases: FoxComm/wings
Releases · FoxComm/wings
clearErrorsFor and more stable `failed` action
Two things in this release:
-
New action
clearErrorsFor
was introduced:import { clearErrorsFor } from '@foxcomm/wings'; class Foo extends Component { componentDidMount() { this.props.fetchProducts(); this.props.fetchTags(); } componentWillUnmount() { this.props.dispatch(clearErrorsFor('fetchProducts', 'fetchTags')); } } export default connect()(Foo);
-
Fixed
failed
action, now it doesn't depend on payload reducer for your async action.
derived addAsyncReducer method
Now makeLocalStore
doesn't apply asyncReducer by default. In order to do same behaviour you should call new exported method addAsyncReducer
to your reducer. Like this:
export _.flowRight(
makeLocalStore(addAsyncReducer(reducer)), // async state will be available in `asyncActions` namespace
connect(...)
)(SuperAwesomeComponent);
Or, in order to have async state directly in root state object:
export _.flowRight(
makeLocalStore(addAsyncReducer(reducer, null)), // async state will be available as is, without any namespace
connect(...)
)(SuperAwesomeComponent);
Added sanitizeError method to ErrorAlerts
Now you can do this:
function sanitizeError(err: string): string {
if (err.startsWith('Items out of stock')) {
return 'Unable to checkout — item is out of stock';
}
}
return (
<ErrorAlerts
error={props.error}
sanitizeError={sanitizeError}
/>
);
paragons invinted
skuIdentity method added