How to maintain navbar state (full width vs. minimized) on reload without layout shift

  • dfeinberg5-1356456469666468014

    Danny

    27 days ago

    I'm creating my application as a multi-page app with sidebar navigation. I'm building the navigation to have a full width state and minimized state, where just the icons show. I'm keeping this state in local storage. The trouble is when navigating from one page to another as a multi-page app I can see some flickering and sometimes the navigation jumping from full width to minimized, since it only reads local storage client-side.

    Is there a way to solve this as a MPA or does think kind of interaction necessitate building as an SPA?

    @Andreas Møller I know you're passionate about MPA, so curious if you have a good solution.
  • andreasmoller-1356485989526409266

    Andreas Møller

    27 days ago

    You would have to set that state in a cookie instead. We don’t have a built in action for setting cookies yet. So it would have to be a custom action
  • dfeinberg5-1356732892939817284

    Danny

    26 days ago

    Do the custom actions only run client side as well?
  • lucasg-1356741540214734959

    Lucas G

    26 days ago

    Yes, all custom code currently runs client-side.
  • dfeinberg5-1356741673744601219

    Danny

    26 days ago

    Thanks! So wouldn’t using a custom action have the same flashing issue as local storage?
  • lucasg-1356745432440504421

    Lucas G

    26 days ago

    The custom action would be to set the cookie
  • Different from reading from local storage client-side
  • dfeinberg5-1356805877331660850

    Danny

    26 days ago

    I’ll give that a shot
  • dfeinberg5-1357121643477991525

    Danny

    25 days ago

    This worked great. Thank you both!