roblox-ts/rbx-rodux

Middleware breaks dispatching

vocksel opened this issue · 1 comments

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():

code_2019-02-10_23-10-49

The action turns into self, instead of being part of the vararg.

Let me know if this is still an issue with 0.0.11.