K-Phoen / backstage-plugin-grafana

Grafana plugin for Backstage
Apache License 2.0
57 stars 33 forks source link

Support for Backstage using React 17? #23

Closed jrbeilke closed 2 years ago

jrbeilke commented 2 years ago

Trying to add the grafana plugin to a new Backstage app and encountering the following error when attempting to load Backstage after adding the plugin:

react.development.js:1465 Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
    at resolveDispatcher (react.development.js:1465:1)
    at Object.useRef (react.development.js:1504:1)
    at Object.useAsyncFn [as default] (useAsyncFn.js:9:1)
    at useAsync (useAsync.js:8:1)
    at useConfigLoader (index.esm.js:2285:1)
    at Provider (index.esm.js:2381:1)
    at ProxyFacade (react-hot-loader.development.js:830:1)
    at renderWithHooks (react-dom.development.js:14985:1)
    at mountIndeterminateComponent (react-dom.development.js:17811:1)
    at beginWork (react-dom.development.js:19049:1)

AFAICT this is being caused by mismatched versions of React (16 in the grafana plugin vs 17 in backstage): https://github.com/backstage/backstage/issues/9119

Will the plugin be updated to support Backstage with React 17?

On an unrelated side note, for anyone else having trouble installing the grafana plugin it looks like the Backstage scaffold no longer includes a plugins.tsx file. The Backstage shortcuts plugin includes documentation on how to add a plugins.ts file to the app again: https://github.com/backstage/backstage/blob/master/plugins/shortcuts/README.md#troubleshooting

K-Phoen commented 2 years ago

Hey!

This should be fixed in v0.1.8 :)