Populate Redux Store and Sidenav (Client-Side?)
Unanswered
Silver Fox posted this in #help-forum
Silver FoxOP
Hello together,
I've got the following two (hopefully) small questions.
1. I've got a redux store which holds the currently signed in user. This allows me to easily access the user client side with the useAuthSelector. Is there an easy way to fill this information with the corresponding user (i.e. get the user server side and somehow populate the redux store with this user?). Using useEffect has the added downside of the data being
2. I've got a sidenav with different options based on the permissions of the currently auth'd user. I'd like to keep this server-side, since including the relevant menu-options seems more trivial that way. However, the sidenav is also supposed to be able to be minimized (by clicking on an icon). What is the best way to do this? Currently, the sidenav in itself is a client-component, whilst the menu-items are from the server. This works, but feels like a bit of a hassle. Would it make more sense to make the side-nav server side and then add a component which handles the minimize/maximize operations on the client?
As you can see, I'm struggling a bit to figure out which page/layout should be a client-/server component. Thanks in advance!
I've got the following two (hopefully) small questions.
1. I've got a redux store which holds the currently signed in user. This allows me to easily access the user client side with the useAuthSelector. Is there an easy way to fill this information with the corresponding user (i.e. get the user server side and somehow populate the redux store with this user?). Using useEffect has the added downside of the data being
undefined until the useEffect has been called, which causes some jumping of the layout. Alternatively: is there a more elegant way to solve this? I.e. have access to the current user on (all) pages and client components. 2. I've got a sidenav with different options based on the permissions of the currently auth'd user. I'd like to keep this server-side, since including the relevant menu-options seems more trivial that way. However, the sidenav is also supposed to be able to be minimized (by clicking on an icon). What is the best way to do this? Currently, the sidenav in itself is a client-component, whilst the menu-items are from the server. This works, but feels like a bit of a hassle. Would it make more sense to make the side-nav server side and then add a component which handles the minimize/maximize operations on the client?
As you can see, I'm struggling a bit to figure out which page/layout should be a client-/server component. Thanks in advance!