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

Question: asynchronous route transition #134

Open
zdila opened this issue Sep 10, 2015 · 1 comment
Open

Question: asynchronous route transition #134

zdila opened this issue Sep 10, 2015 · 1 comment

Comments

@zdila
Copy link

zdila commented Sep 10, 2015

Hello

I am new to React and Flux.

On this line https://github.com/BinaryMuse/fluxxor/blob/master/examples/react-router/app/components/recipe_editor.jsx#L85 when the recipe is edited there is a transition to recipe view.

How to implement it if I have asynchronous object saving? My code is inspired from https://github.com/BinaryMuse/fluxxor/tree/master/examples/async and so the transition should happen after SAVE_RECIPE_SUCCESS. I see 3 alternatives:

  1. transition is done in the store on SAVE_RECIPE_SUCCESS
  2. transition is done in the JSX component where I check some flag in getStateFromFlux
  3. transition is done in the JSX component where I listen for emitted eg. "save" event
  4. ???

Which should be the preferred way (and why)?

Thanks!

@BinaryMuse
Copy link
Owner

Hi, @zdila,

There are still some differing opinions on this. The "route store" idea is fairly popular, and I'd probably recommend that if you wanted to "stay fluxy" (so basically transition in a special routing store in SAVE_RECIPE_SUCCESS), though more and more I'm starting to think the complexity in managing it anywhere but inside a callback is just not worth the trade-off (e.g. maybe we should just redirect in a callback). Have you seen the discussion at #132? It's related to this topic.

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