You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E.g. a form submits via an action, then the action errors. We want to display the error to the user, but when the form goes away we want to stop storing the error (or, at minimum, ensure it doesn't show the next time we display the form).
We can clear the error with an action in componentWillUnmount, which requires more boilerplate than we'd like. Maybe there's a way to generalize this transitive state problem to make dealing with these kinds of things easier.
For transitive data, would it be very much against the standard of Flux, return a promise in the component? Sample:
varactions={searchUsers: function(params){varself=this;returnWebAPI.searchUsers(params).success(function(data){self.dispatch(constants.SEARCH_USERS_SUCCESS,data);}).error(function(data){self.dispatch(constants.SEARCH_USERS_ERROR,data);});}};React.createClass({handleClick: function(){this.setState({loading: true});this.getFlux().actions.searchUsers(...).always(function(){this.setState({loading: false});};}});// Store dont need to know about loading data, and dont need to re-render everthing just because that.
E.g. a form submits via an action, then the action errors. We want to display the error to the user, but when the form goes away we want to stop storing the error (or, at minimum, ensure it doesn't show the next time we display the form).
We can clear the error with an action in
componentWillUnmount
, which requires more boilerplate than we'd like. Maybe there's a way to generalize this transitive state problem to make dealing with these kinds of things easier.See also https://gist.github.com/thomasboyt/5a2fda0db3af7d93c8b6 by @thomasboyt
The text was updated successfully, but these errors were encountered: