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
Using the shell pattern instead of re-rendering the root which I should have done in the first place.
Initial post
When a component inside Layout.Drawer is re-rendered, no changes are present.
When using the exact same component out of the Layout.Drawer it works perfectly.
Here is the architecture of the parts related to this issue.
./app.js
exportdefaultclassAppextendsComponent{state={user: null}constructor(props){super(props)constconfig={
...
}firebase.initializeApp(config)}render({},{ user }){return(<divid="app"><linkrel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"/><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons"/><Layoutfixed-headerfixed-drawer><Headertitle="Blog"/><Layout.DraweronClick={this.toggleDrawer}><Layout.Title>Menu</Layout.Title><SidebarNavigationuser={user}onSignIn={this.handleSignIn}onSignOut={this.handleSignOut}/></Layout.Drawer><Layout.Content><RouteronChange={this.handleRoute}><Homepath="/"exact/><ArticleDetailspath="/article/:articleKey"/><ArticleListpath="/article-list"/><ArticleEditorpath="/article-editor"/><ErrorRoutedefault/></Router></Layout.Content></Layout></div>)}handleRoute=event=>{this.currentUrl=event.url}handleSignIn=()=>{constprovider=newfirebase.auth.GoogleAuthProvider();firebase.auth().signInWithPopup(provider).then(({ user })=>{firebase.database().ref('users').child(user.uid).once('value').then((snapshot)=>this.setState({user: Object.assign(user,snapshot.val())}))})}handleSignOut=()=>{firebase.auth().signOut().then(()=>this.setState({user: null}))}toggleDrawer=()=>{if(this.base){constlayout=this.base.querySelector('.mdl-layout')if(layout.classList.contains('is-small-screen')){layout.MaterialLayout.toggleDrawer()}}}}
./navigation/drawer/index.js
exportdefaultclassSidebarNavigationextendsComponent{render=({ user })=>{returnuser&&user.admin ?
(<AdminNavigationonSignOut={this.props.onSignOut}/>) : (<UserNavigationonSignIn={this.props.onSignIn}/>)}}
Solved
Using the shell pattern instead of re-rendering the root which I should have done in the first place.
Initial post
When a component inside
Layout.Drawer
is re-rendered, no changes are present.When using the exact same component out of the
Layout.Drawer
it works perfectly.Here is the architecture of the parts related to this issue.
./app.js
./navigation/drawer/index.js
./navigation/drawer/user/index.js
./navigation/drawer/admin/index.js
The text was updated successfully, but these errors were encountered: