Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: useLocation() may be used only in the context of a <Router> component #4

Open
danielgonzalez3 opened this issue Apr 6, 2023 · 0 comments · May be fixed by #6
Open

Error: useLocation() may be used only in the context of a <Router> component #4

danielgonzalez3 opened this issue Apr 6, 2023 · 0 comments · May be fixed by #6

Comments

@danielgonzalez3
Copy link

danielgonzalez3 commented Apr 6, 2023

Description

Upon updating backstage from 1.6.0 to 1.12.1 I am experiencing an error in my React application that says "useLocation() may be used only in the context of a component." The existing dependencies are shown below:

backstage-plugin-teamcity@^1.0.2:
version "1.0.2"
resolved "https://.com/artifactory/api/npm/npm-group/backstage-plugin-teamcity/-/backstage-plugin-teamcity-1.0.2.tgz
dependencies:
"@backstage/catalog-model" "^1.1.1"
"@backstage/core-components" "^0.11.1"
"@backstage/core-plugin-api" "^1.0.6"
"@backstage/plugin-catalog-react" "^1.1.4"
"@backstage/theme" "^0.2.16"
"@material-ui/core" "^4.9.13"
"@material-ui/icons" "^4.9.1"
"@material-ui/lab" "4.0.0-alpha.57"
moment "^2.29.4"
react "^17.0.2"
react-dom "^17.0.2"
react-router "6.0.0-beta.0"
react-router-dom "6.0.0-beta.0"
react-use "^17.2.4"

On app side I removed:
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^15.3.3"

And added:
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-use": "^17.2.4"

👎 Actual Behavior with Screenshots

image

Is it possible that using different versions of react-router and react-router-dom between the plugin and backstage could cause compatibility issues?

Reproduction steps

  1. Execute create-app https://backstage.io/docs/getting-started/create-an-app/
  2. Add Plugin from README.md

Environment

OS: Darwin 22.3.0 - darwin/x64
node: v16.13.2
yarn: 1.22.17
cli: 0.19.0 (installed)
backstage: 1.6.0

Dependencies:
@backstage/app-defaults 1.0.6
@backstage/backend-app-api 0.2.3
@backstage/backend-common 0.15.1, 0.15.2, 0.16.0
@backstage/backend-plugin-api 0.1.2, 0.1.3, 0.1.4
@backstage/backend-tasks 0.3.5, 0.3.6, 0.3.7
@backstage/backend-test-utils 0.1.30
@backstage/catalog-client 1.1.0, 1.1.1
@backstage/catalog-model 1.1.1, 1.1.2
@backstage/cli-common 0.1.10
@backstage/cli 0.19.0, 0.21.1
@backstage/config-loader 1.1.4, 1.1.5, 1.1.6
@backstage/config 1.0.2, 1.0.3, 1.0.4
@backstage/core-app-api 1.1.0
@backstage/core-components 0.11.1
@backstage/core-plugin-api 1.0.6
@backstage/errors 1.1.1, 1.1.2, 1.1.3
@backstage/integration-react 1.1.4
@backstage/integration 1.3.1, 1.3.2, 1.4.0
@backstage/plugin-api-docs 0.8.9
@backstage/plugin-app-backend 0.3.36
@backstage/plugin-auth-backend 0.16.0
@backstage/plugin-auth-node 0.2.5, 0.2.6, 0.2.7
@backstage/plugin-catalog-backend-module-ldap 0.5.4
@backstage/plugin-catalog-backend 1.4.0, 1.5.0
@backstage/plugin-catalog-common 1.0.6, 1.0.7
@backstage/plugin-catalog-graph 0.2.21
@backstage/plugin-catalog-import 0.8.12
@backstage/plugin-catalog-node 1.1.0, 1.2.0
@backstage/plugin-catalog-react 1.1.4
@backstage/plugin-catalog 1.5.1
@backstage/plugin-github-actions 0.5.9
@backstage/plugin-org 0.5.9
@backstage/plugin-pagerduty 0.5.2
@backstage/plugin-permission-backend 0.5.11
@backstage/plugin-permission-common 0.6.4, 0.7.0, 0.7.1
@backstage/plugin-permission-node 0.6.5, 0.7.0, 0.7.1
@backstage/plugin-permission-react 0.4.5
@backstage/plugin-proxy-backend 0.2.30
@backstage/plugin-scaffolder-backend 1.6.0
@backstage/plugin-scaffolder-common 1.2.0, 1.2.1
@backstage/plugin-scaffolder 1.6.0
@backstage/plugin-search-backend-module-elasticsearch 1.0.2
@backstage/plugin-search-backend-module-pg 0.4.0
@backstage/plugin-search-backend-node 1.0.2
@backstage/plugin-search-backend 1.0.2
@backstage/plugin-search-common 1.0.1, 1.1.0
@backstage/plugin-search-react 1.1.0
@backstage/plugin-search 1.0.2
@backstage/plugin-sonarqube-backend 0.1.1
@backstage/plugin-sonarqube 0.4.1
@backstage/plugin-tech-radar 0.5.16
@backstage/plugin-techdocs-backend 1.3.0
@backstage/plugin-techdocs-module-addons-contrib 1.0.4
@backstage/plugin-techdocs-node 1.4.0
@backstage/plugin-techdocs-react 1.0.4
@backstage/plugin-techdocs 1.3.2
@backstage/plugin-user-settings 0.4.8
@backstage/release-manifests 0.0.6, 0.0.7
@backstage/test-utils 1.2.0
@backstage/theme 0.2.16
@backstage/types 1.0.0, 1.0.1
@backstage/version-bridge 1.0.1

kmatyukhin added a commit to kmatyukhin/backstage-teamcity that referenced this issue Apr 12, 2023
@kmatyukhin kmatyukhin linked a pull request Apr 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant