abc123s / redux-batch-enhancer Goto Github PK
View Code? Open in Web Editor NEWBatch subscriber notification for an array of actions (including complex actions, e.g. thunks).
Batch subscriber notification for an array of actions (including complex actions, e.g. thunks).
Hi,
is nesting batchActions supported? I am experiencing some issues which i cannot pinpoint right now.
We use babel with presets: "es2015", "react", "stage-2"
ERROR in ./~/redux-batch-enhancer/index.js
Module parse failed: /Users/ejashig/Documents/workspace/insight-new/node_modules/redux-batch-enhancer/index.js Unexpected token (92:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (92:6)
at Parser.pp.raise (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:923:13)
at Parser.pp.unexpected (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:1490:8)
at Parser.pp.parseIdent (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:680:10)
at Parser.pp.parsePropertyName (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:556:127)
at Parser.pp.parseObj (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:502:10)
at Parser.pp.parseExprAtom (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:316:19)
at Parser.pp.parseExprSubscripts (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:228:19)
at Parser.pp.parseMaybeUnary (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:207:17)
at Parser.pp.parseExprOps (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:154:19)
at Parser.pp.parseMaybeConditional (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:136:19)
at Parser.pp.parseMaybeAssign (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:112:19)
at Parser.pp.parseExpression (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:88:19)
at Parser.pp.parseReturnStatement (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:1872:26)
at Parser.pp.parseStatement (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:1737:19)
at Parser.pp.parseBlock (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:2009:21)
at Parser.pp.parseFunctionBody (/Users/ejashig/Documents/workspace/insight-new/node_modules/webpack/node_modules/acorn/dist/acorn.js:610:22)
@ ./src/actions/DashboardActions.js 56:26-57
my proposal:
return Object.assign({}, store, {
dispatch,
subscribe,
subscribeImmediate
});
/*return {
...store,
dispatch,
subscribe,
subscribeImmediate
};*/
I assume I am doing something wrong in general. After building i get a JS error in console: Unexpected token export. Somehow this needs to converted so the browser understands it, right?
function receiveData(data) {
return {
type: APPLICATION_ACTIONS.RECEIVE_DATA,
data
};
}
export function getData() {
return dispatch => {
return fetch("url")
.then(data => dispatch(receiveData(data)));
};
}
export function login(credentials) {
return (dispatch, getState) => {
return UserService.login(credentials)
.then(() => {
const action = batchActions([
onLogin(),
getData().then(() => {
dispatch(navigate("/"));
})
]);
dispatch(action);
});
};
}
the code above works without batching with plane thunk. Using batching it does not work. I do not get any error either. If I remove the then, it works. But the application flow is broken. Any ideas?
Regards
There is no actual test on this library
While using an encompassing project with vite, I found out that it was unable to find the redux-batch-enhancer
entry point. It appears the package.json file has two main
entries, of which the first seems to be incorrect. In any case, there should only be one entry and it should ideally be the correct one.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.