Skip to content

Commit

Permalink
make sidebars layout effects
Browse files Browse the repository at this point in the history
  • Loading branch information
KAJdev committed Jul 23, 2023
1 parent 753eb57 commit 0a92760
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/stablestudio-ui/src/App/Sidebar/Tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export namespace Tab {
GlobalState.shallow
);

useEffect(() => {
useLayoutEffect(() => {
setTab(props.name, { enabled: true, ...props });
return () => setTab(props.name);
}, [props, setTab]);

useEffect(() => {
useLayoutEffect(() => {
(window.location.pathname === props.route ||
(window.location.pathname === "/" && props.defaultActive)) &&
setSidebar((sidebar) => ({ ...sidebar, tab: props.name }));
Expand Down

0 comments on commit 0a92760

Please sign in to comment.