Middleware breaks dispatching
vocksel opened this issue · 1 comments
vocksel commented
Calls to dispatch
compile to dot notation when using middleware, which prevents actions from ever dispatching.
const sharedStore = new Store(rootReducer, undefined, [
loggerMiddleware
])
sharedStore.dispatch({ type: "FOO", payload: "bar" })
local sharedStore = Store.new(rootReducer, nil, { loggerMiddleware });
sharedStore.dispatch({ -- note . instead of :
type = "FOO";
payload = "bar";
});
Without middleware (normal):
const sharedStore = new Store(rootReducer)
sharedStore.dispatch({ type: "FOO", payload: "bar" })
local sharedStore = Store.new(rootReducer);
sharedStore:dispatch({ -- works fine and actions dispatch normally
type = "FOO";
payload = "bar";
});
The reason they don't dispatch is because of this in Store.new()
:
The action turns into self
, instead of being part of the vararg.
Vorlias commented
Let me know if this is still an issue with 0.0.11
.