I started playing with reaction via flummox, reaction bootstrap and react router. I am trying to create a basic isomorphic CMS for my sites.
Context:
In terms of authentication, each user has a list of features, and each component uses my βcanβ repository method to authenticate or not, etc.
I have a custom navigation bar at the top, visible on every page processed by reat-router, with a signin / out button, which basically displays on the Modal click with the signin form if the user has not registered a logout confirmation yet.
When a user logs in, I want updated components to be displayed on the updated page (for logging out).
Here is an example with a page that displays a list that can only be viewed by an authenticated user with the appropriate rights:
Process:
- When a user submits a form, I invoke an action
- The action sends a request to the server
- The action is registered by the authentication store, which updates its currentUser
- The component has currentUser support and uses componentWillReceiveProps to check if this alert has changed and trigger an action to request a list
- the action is recorded by the store, updating its elements.
Problem: Unable to send message in the middle of sending
Hack: The second action is placed in setTimeout
Questions: I read a lot of answers about this particular problem, and they say that it is a bad design to trigger two actions during the same dispatcher cycle. So my question is: is there a better way to develop this process?
PS: If necessary, I can publish the code.
reactjs react-router react-bootstrap flux flummox
Gregory bouteiller
source share