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

makeHot doesn't accept possible Store parameters #408

Open
bebraw opened this issue Jul 20, 2015 · 3 comments
Open

makeHot doesn't accept possible Store parameters #408

bebraw opened this issue Jul 20, 2015 · 3 comments

Comments

@bebraw
Copy link

bebraw commented Jul 20, 2015

I was trying to port code such as this.store = alt.createStore(NoteStore, storeName, this.actions); to use makeHot. Sadly it looks like makeHot doesn't allow parameters to be passed to Store. I expect that for this to work you would need to do something like:

function makeHot(alt, Store, name = Store.displayName, parameters) {
  if (module.hot) {
    module.hot.dispose(() => {
      delete alt.stores[name]
    })
  }

  return alt.createStore(Store, name, parameters)
}

export default makeHot

Maybe this was just a simple oversight? I can provide a PR if you want but given it's so trivial change, perhaps just add it there yourself it this makes sense to you.

@bebraw
Copy link
Author

bebraw commented Jul 23, 2015

As discussed at gitter likely the most sensible solution is to actually integrate this to createStore and then check disable the check when compiling with NODE_ENV is set to production. That way it stays simple from user point of view and the utility can be dropped eventually.

@bebraw
Copy link
Author

bebraw commented Jul 30, 2015

Do you want a PR for this? I would love to get this resolved as book readers will hit on it for sure. 👍

@goatslacker
Copy link
Owner

Sure thing!

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

No branches or pull requests

2 participants