Skip to content

Commit d3f2379

Browse files
fix: layout test by using useLocation consistently from react-router-dom
The Layout.test.tsx broke in github run tests with: ``` FAIL src/domain/app/__tests__/Layout.test.tsx > renders without crashing Error: useLocation() may be used only in the context of a <Router> component. ❯ invariant node_modules/react-router/dist/development/index.js:327:11 325| function invariant(value, message) { 326| if (value === false || value === null || typeof value === "un 327| throw new Error(message); | ^ 328| } 329| } ❯ useLocation node_modules/react-router/dist/development/index.js:4229: ❯ useCmsLanguageOptions src/hooks/useCmsLanguageOptions.ts:11:20 ❯ Navigation src/domain/app/navigation/Navigation.tsx:21:30 ❯ renderWithHooks node_modules/react-dom/cjs/react-dom.development.js:1 ❯ mountIndeterminateComponent node_modules/react-dom/cjs/react-dom.deve ❯ beginWork node_modules/react-dom/cjs/react-dom.development.js:21626:1 ❯ beginWork$1 node_modules/react-dom/cjs/react-dom.development.js:27465 ❯ performUnitOfWork node_modules/react-dom/cjs/react-dom.development.js ❯ workLoopSync node_modules/react-dom/cjs/react-dom.development.js:2650 ``` Importing useLocation consistently from react-router-dom, previously it was imported mostly from react-router-dom but once from react-router
1 parent ed32114 commit d3f2379

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/hooks/useCmsLanguageOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useLocation } from 'react-router';
1+
import { useLocation } from 'react-router-dom';
22

33
import { usePageQuery } from './usePageQuery';
44

0 commit comments

Comments
 (0)