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

having possibility to load the reducers dynamically #102

Open
bpetetot opened this issue Feb 18, 2018 · 2 comments
Open

having possibility to load the reducers dynamically #102

bpetetot opened this issue Feb 18, 2018 · 2 comments
Labels
feature help wanted Extra attention is needed proposal

Comments

@bpetetot
Copy link
Collaborator

bpetetot commented Feb 18, 2018

k-ramel already propose the ability to load listeners dynamically.

Do you think that it could also load some reducers dynamically in order to have a complete separation of some screens ?

For example, in my app, I have an admin page that managing all my application users. And I have specific reducers (users data, admin screens data) specific to that page. So I could have a container loading k-ramel reducers and listeners specific to it :

import { updateStore, when } from '@k-ramel/react'
import AdminPage from './AdminPage'

updateStore({
  data: { users: { type: 'keyValue', id: 'uid' } },
  ui: { admin: { type: 'simpleObject' } },
}, [
  when('MY_ADMIN_ACTION')(() => { /* do something */ })
]})(AdminPage)

And it could be a great optimisation for apps using code splitting (dynamic imports).

@fabienjuif
Copy link
Member

Yes we could I thank about it a lot.
All of this is related to:

(#94/#102/#72) this is about hot loading reducers / configurations

But this is a big issue to think about since:

  • We don't want to have overhead when we re configure the store
  • We can't dispatch in reducers
  • We can't dispatch when a dispatch is running (redux 4)

@fabienjuif
Copy link
Member

An other thing we can do is to create a local store for your screen.
We can get inspiration from https://github.com/alakarteio/multi-store-redux-saga so all events pass through parent store.

@fabienjuif fabienjuif added the help wanted Extra attention is needed label Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted Extra attention is needed proposal
Projects
None yet
Development

No branches or pull requests

2 participants