Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the parent action that cause new dispatch in reactions #94

Closed
fabienjuif opened this issue Feb 16, 2018 · 1 comment
Closed

Set the parent action that cause new dispatch in reactions #94

fabienjuif opened this issue Feb 16, 2018 · 1 comment
Labels

Comments

@fabienjuif
Copy link
Member

So it is easier to debug.

{
  type: 'NEW_ACTION_FROM_REACTON', 
  payload: 'reaction payload',
  parent: {
    type: '@@krml/INIT'
  }
}
  • I can't use middlewares
  • I can't use my own dispatch middleware to set parent then run reactions, because of async reaction
  • So I have this in mind right know
  // 1. Attach { getState, dispatch } to each krf reducers
  // 2. krf reducers "toContext" use that instead of given store
  // 3. Have a function to set new { getState, dispatch } to each krf reducers
  // 4. Use this to set store the first time
  // 5. Have a function to clone the reducer tree (each krf) given a the store (clone the store)
  //      /!\ Take care, it should not clone the store (redux one)
  // 6. In listener middleware
  //   a. Clone the store (with all krf reducer cloned)
  //   b. Set the new { getState, dispatch } with enhanced dispatch
  //   c. Pass the new "store" to reactions
  /* const keys = [...Object.keys(reduxStore), 'listeners']
  const reducerTreeKeys = Object.keys(store).filter(key => !keys.includes(key))
  console.log(Object.keys(store.config)) */
@fabienjuif
Copy link
Member Author

I close this issue since trace option exists on redux-devtools.

See #260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant