ioof-holdings / redux-subspace

Build decoupled, componentized Redux apps with a single global store
https://ioof-holdings.github.io/redux-subspace/
BSD 3-Clause "New" or "Revised" License
312 stars 33 forks source link

Subspaced Saga - React to global action #304

Closed piotrkochan closed 4 years ago

piotrkochan commented 4 years ago

Is it a bug, feature request or question?

Question

Which package(s) does this involve?

redux-subspace-saga

Input Code

Subspaced saga:

function* doThings() {
 // not firing
}

export default function* rootSaga() {
    yield all([
        takeEvery(GLOBAL_ACTION, doThings),

Root saga:

export default function* rootSaga() {
   call(subspaced(state=>state.a, "mySubspace")(selector)),
}

Expected Behavior

I would like to catch actions fired in the global space.

Current Behavior

Subspaced saga reacts only to namespaced actions.

Possible Solution

Maybe there is a way to do that. Of course I can takeEvery(GLOBAL_ACTION); in global saga and re-yield them as namespaced.

mpeyper commented 4 years ago

All namespace boundaries (whether they be for reducers, sagas or anything else) are supposed to process any relevantly namespaced actions and global actions.

How are you dispatching the global action? As a plain action into the global store or using the globalAction utility/globalActions middleware?

piotrkochan commented 4 years ago

I'm just dispatching plain action but I'll try with the globalAction utility, thanks!

mpeyper commented 4 years ago

Yeah, that would explain it. Let me know how you go.

piotrkochan commented 4 years ago

It works