Skip to content

Commit 0668ed2

Browse files
committed
Disable constant navigation opening on route change.
1 parent f480440 commit 0668ed2

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

packages/react-renderer-demo/src/app/src/components/component-example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const useStyles = makeStyles((theme) => ({
7272
},
7373
spinnerCheat: {
7474
flex: 1,
75-
position: 'relative'
75+
position: 'relative',
76+
boxShadow: theme.shadows[1]
7677
},
7778
spinner: {
7879
position: 'absolute',
@@ -89,7 +90,6 @@ const useStyles = makeStyles((theme) => ({
8990
},
9091
'& iframe': {
9192
border: 'none',
92-
boxShadow: theme.shadows[1],
9393
[theme.breakpoints.down('sm')]: {
9494
height: 500
9595
}

packages/react-renderer-demo/src/app/src/components/layout.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,15 @@ const Layout = ({ children }) => {
139139
const [openNotification, setOpenNotifiation] = useState(false);
140140
const [newMessages, setNewMessages] = useState(0);
141141

142+
useEffect(() => {
143+
setLinks(findConnectedLinks(router.asPath, flatSchema) || {});
144+
}, [router.asPath]);
145+
142146
useEffect(() => {
143147
if (window && window.innerWidth > 960 && router.pathname !== '/') {
144148
setOpen(true);
145149
}
146-
147-
setLinks(findConnectedLinks(router.asPath, flatSchema) || {});
148-
}, [router.asPath]);
150+
}, []);
149151

150152
const handleDrawerOpen = () => {
151153
setOpen(true);

packages/react-renderer-demo/src/app/src/components/navigation/menu-renderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable react/prop-types */
2-
import React, { useState, useRef } from 'react';
2+
import React, { useState } from 'react';
33
import TextField from '@material-ui/core/TextField';
44
import { useRouter } from 'next/router';
55
import Mapper from './mapper';
@@ -124,13 +124,13 @@ const memoizeCurrent = () => {
124124
};
125125

126126
const search = memoizeSearch();
127+
const current = memoizeCurrent();
127128

128129
const Menu = ({ schema, searchRef }) => {
129130
const router = useRouter();
130131
const [value, setValue] = useState('');
131132
const classes = useStyles();
132133
const currentLocation = router.pathname.split('/');
133-
const { current } = useRef(memoizeCurrent());
134134

135135
const schemaFiltered = value !== '' ? search(schema, value) : current(schema, currentLocation);
136136

0 commit comments

Comments
 (0)