Skip to content

Commit 67043d9

Browse files
committed
location hook
1 parent 7b26a79 commit 67043d9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

client/modules/IDE/pages/IDEView.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ const IDEView = (props) => {
8787

8888
const autosaveIntervalRef = useRef(null);
8989

90+
const location = useLocation();
91+
9092
const prevFileNameRef = useRef(selectedFile.name);
91-
const locationRef = useRef(props.location);
93+
const locationRef = useRef(location.pathname);
9294

9395
const syncFileContent = () => {
9496
const file = cmRef.current.getContent();
@@ -110,7 +112,7 @@ const IDEView = (props) => {
110112
// for setting previous location
111113
useEffect(() => {
112114
dispatch(setPreviousPath(locationRef.current.pathname));
113-
}, [props.location]);
115+
}, [location.pathname]);
114116

115117
// For autosave
116118
useEffect(() => {
@@ -273,9 +275,6 @@ IDEView.propTypes = {
273275
project_id: PropTypes.string,
274276
username: PropTypes.string,
275277
reset_password_token: PropTypes.string
276-
}).isRequired,
277-
location: PropTypes.shape({
278-
pathname: PropTypes.string
279278
}).isRequired
280279
};
281280

0 commit comments

Comments
 (0)