Open maxs15 opened 8 years ago
It looks to be just a warning but I'm seeing the same thing. This seems like a valid use case of an action.
Even the documentation on Actions indicates as much:
There are two exceptions to this, however:
Returning undefined (or omitting return altogether) will not dispatch the action
Returning a Promise will not dispatch the action
Async actions in particular come to mind where I want to dispatch an action which fires an ajax request and when I get the result defer to success/failed.
Is there any reason to keep the warning?
class DemoActions{
a() {
return dispatch => {
dispatch();
$.get('/xxx', data => {
this.getSuccess(data);
}).fail(() => {
this.getFail('error');
});
};
}
}
// or
class DemoActions{
a() {
return dispatch => {
$.get('/xxx', data => {
dispatch(data);
});
};
}
}
I'm looking for a way to prevent an action to update the store but I didn't find anything in the documentation. Is there a way to achieve this ? I tried just returning
return;
but I got an error[ReferenceError: An action was called but nothing was dispatched]
Is there maybe a way to unable the logs ?
Thanks