Closed luisfuertes closed 7 years ago
Hmmm, from this code only it's hard to tell, but you could run some kind of action wich fires that alert. Also you should place <Alert ...> component in your main app component or at least as close to root component as possible.
Yes, sorry. My main Container (Common in all app)
import React from 'react'
// Components
import Sidebar from './Sidebar'
import Header from './Header'
import ErrorDialog from './ErrorDialog'
//Redux
import { connect } from 'react-redux'
import * as Actions from '../../redux/actions/Auth'
class Container extends React.Component {
componentWillMount(){
this.props.checkLogin()
}
render() {
if(!this.props.logged ){
return (
<div>
{this.props.children}
<ErrorDialog />
</div>
)
} else {
return (
<div className="wrapper">
<Header />
<Sidebar />
<section className="main">
{ this.props.children }
<ErrorDialog />
</section>
</div>
)
}
}
}
let mapStateToProps = (state) => {
return {
logged: state.auth.isLogged,
userInfo: state.user.userInfo,
}
}
let mapDispatchToProps = (dispatch) => {
return {
checkLogin: () => {
dispatch(Actions.checkStorage())
}
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Container)
When some WS fail, i dispatch error and
And in some views, when some actions are success i do:
import Alert from 'react-s-alert';
Alert.success('success message')
After it, all my Alerts.error show first my old Alert.success
Is there a chance to create a simple reproduction repository with this bug? I will be able to test it on my side and tell you more.
I have tried to reproduce an example from the base of my project and I can not replicate the bug.
I will close the issue until I have more information about it
Thanks!
Hi, i have this code on my "Container"
Works fine, but if in other view i do: "Alert.success('bla bla bla')", after that whenever I make an alert.error, it also shows the Alert.success also.
How can i fix it? Thanks!