Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Navigate doesn't refresh useRoutes #162

Open
fstn opened this issue May 31, 2021 · 3 comments
Open

Navigate doesn't refresh useRoutes #162

fstn opened this issue May 31, 2021 · 3 comments

Comments

@fstn
Copy link

fstn commented May 31, 2021

Hi,
I have a quite complex application with lots of nested routes.

I removed React strict mode.

The only workaround I found was to put this on all components that useRoutes:

    const path = usePath();
    const [path, updateState] = useImmer({ loaded: false, routes: undefined as any, path: '' });

    useEffect(() => {
        updateState((draft) => {
            draft.path = path;
        });
    }, [updateState, path]);

Or to use window.location.href = url;

How can I debug this?

I try to make a sandBox but was not able to reproduce it in a small example.

This is my dependencies

    "@ant-design/icons": "^4.2.2",
    "@babel/plugin-transform-react-jsx-development": "^7.12.17",
    "@craco/craco": "^5.6.4",
    "@emotion/babel-preset-css-prop": "^10.0.27",
    "@emotion/core": "10.0.28",
    "@emotion/styled": "^10.0.27",
    "@fortawesome/fontawesome-svg-core": "^1.2.32",
    "@fortawesome/free-solid-svg-icons": "^5.15.1",
    "@fortawesome/react-fontawesome": "^0.1.11",
    "@fstn/ecandidaturev2_api-interfaces": "^1.0.392",
    "@inovua/reactdatagrid-community": "^4.0.25",
    "@jackwilsdon/craco-use-babelrc": "^1.0.0",
    "@lyracom/embedded-form-glue": "^0.3.3",
    "@react-pdf/renderer": "^1.6.12",
    "@react-pdf/styled-components": "^1.4.0",
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^10.4.9",
    "@types/uuid-js": "^0.7.2",
    "@typescript-eslint/eslint-plugin": "^4.4.1",
    "@typescript-eslint/parser": "^4.1.1",
    "@welldone-software/why-did-you-render": "^6.1.1",
    "antd": "^4.6.6",
    "antd-button-color": "^1.0.3",
    "antd-mask-input": "^0.1.15",
    "awesome-debounce-promise": "^2.1.0",
    "axios": "^0.19.2",
    "axios-cache-plugin": "^0.1.0",
    "axios-extensions": "^3.1.3",
    "bulma": "^0.9.2",
    "bulma-helpers": "^0.4.0",
    "class-transformer": "0.3.1",
    "class-validator": "^0.13.1",
    "color": "^3.1.3",
    "core-js": "^3.6.5",
    "craco-antd": "^1.18.1",
    "emotion-theming": "^10.0.27",
    "flatted": "^3.1.1",
    "hookrouter": "^1.2.5",
    "i18next": "^19.6.3",
    "i18next-http-backend": "^1.0.18",
    "immer": "^7.0.7",
    "js-file-download": "^0.4.12",
    "kebab-case": "^1.0.0",
    "lodash": "^4.17.20",
    "material-design-icons": "^3.0.1",
    "moment": "2.25.3",
    "pdf-viewer-reactjs": "^2.1.1",
    "query-string": "^6.13.1",
    "rc-field-form": "^1.13.0",
    "react": "^16.13.1",
    "react-csv-importer-v2": "^0.1.0",
    "react-currency-format": "^1.0.0",
    "react-dom": "^16.13.1",
    "react-facebook-login": "^4.1.1",
    "react-google-recaptcha": "^2.1.0",
    "react-i18next": "^11.7.0",
    "react-redux": "^7.2.1",
    "react-scripts": "3.4.3",
    "react-viewer": "^3.2.2",
    "rebass": "^4.0.7",
    "redux": "^4.0.5",
    "regenerator-runtime": "^0.13.7",
    "rimraf": "^3.0.2",
    "rxjs": "^6.5.5",
    "traverse": "^0.6.6",
    "ts-loader": "^8.0.4",
    "use-debounce": "^3.4.3",
    "use-deep-compare": "^1.1.0",
    "use-immer": "^0.4.1",
    "use-mobile-detect-hook": "^1.0.3",
    "uuid": "^8.3.0",
    "uuid-js": "^0.7.5"
@fstn
Copy link
Author

fstn commented Sep 22, 2021

Any update?

@yudao
Copy link

yudao commented Feb 7, 2022

hi @fstn this repository is apparently dead.

I had the same behaviour one time and it was caused by <StrictMode>...</StrictMode>, but strangely, only on dev never on production build.

@fstn
Copy link
Author

fstn commented Feb 7, 2022

@yudao I'm forcing the refresh by checking the url using regexp...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants