Make all functions in the API follow the same signature:
Tentative: Pass the options (the same from app(options)) object to loaded as data, so it can match the proposed signature too. 🤔
events.loaded(state, actions, emit) — @jbucaran
Maybe it's better to just use state, actions, _, emit here, where _ is (right now) always undefined? It streamlines everything and if we ever decide that we need data we don't have to break the API.
It's also not unheard of. JSON.stringify({}, null, '\t') is similarly used. Of course null doesn't have to be null here, but I've seen this a lot.
@dodekeract Good point!
This is a breaking change, as you'll need to modify all your actions signature from:
(state, data, _actions_)
to
(state, _actions_, data)
@selfup @pedroborges @cdeutmeyer @lukejacksonn Are we okay with this?
The difference between (s,a,d) and (s,d,a) has always niggled me and it would certainly mean one less thing for users to remember.. for these reasons I am all for it.
I also support @dodekeract's statement of using state, actions, _, emit for loaded. Just to keep things super consistent. Your proposal @jbucaran of passing options as the data for that function is also not a bad idea at all 👍
Most helpful comment
This is a breaking change, as you'll need to modify all your actions signature from:
(state, data, _actions_)
to
(state, _actions_, data)
@selfup @pedroborges @cdeutmeyer @lukejacksonn Are we okay with this?