backstage: ๐Ÿ› Bug Report: TechDocsAddons breaks rendering Tech Docs pages after updating to 1.8

๐Ÿ“œ Description

Updated from version 1.7.0 -> 1.8.3 using yarn backstage-cli versions:bump. After the upgrade, all tech docs pages failed to render.

The <TechDocsAddons> component from @backstage/plugin-techdocs-react breaks rendering of tech docs pages. There is no error output in the browser console or logs, as if perhaps thereโ€™s a null check that doesnโ€™t render if data is missing. If the section is commented out, the page loads as expected. This behavior only occurs when children are nested underneath the component. i.e.,

      <TechDocsAddons>
        <ReportIssue />
      </TechDocsAddons>

I also tried rendering the Mermaid addon underneath and got the same behavior. If you leave it without children, nothing breaks.

A search through Discord showed other people experiencing similar behavior as early as 1.8.2. Iโ€™m trying to bump to 1.8.3, but Iโ€™m not sure which specific version is causing the problem.

๐Ÿ‘ Expected behavior

TechDocsAddons component can be used on TechDocs pages without rendering issues.

๐Ÿ‘Ž Actual Behavior with Screenshots

Page fails to render any content:

Screen Shot 2022-12-08 at 2 10 54 PM

No console errors or logs indicating anything is wrong.

๐Ÿ‘Ÿ Reproduction steps

Have a project that is using the TechDocsAddons component when rendering TechDocs on version 1.7.*. Use any addon as a child.

Upgrade backstage using the cli command yarn backstage-cli versions:bump to bring everything up to the latest version.

View TechDocs pages.

๐Ÿ“ƒ Provide the context for the Bug.

Removing TechDocsAddons works as a temporary work-around, but Iโ€™d like to continue using addons. I am waiting on the upgrade for my project until we can fix.

๐Ÿ–ฅ๏ธ Your Environment

OS: Darwin 21.6.0 - darwin/x64 node: v16.18.1 yarn: 1.22.0 cli: 0.21.1 (installed) backstage: 1.8.3

Dependencies: @backstage/app-defaults 1.0.8 @backstage/backend-common 0.15.2, 0.16.0 @backstage/backend-plugin-api 0.1.4 @backstage/backend-tasks 0.3.7 @backstage/catalog-client 1.1.2 @backstage/catalog-model 1.1.3 @backstage/cli-common 0.1.10 @backstage/cli 0.21.1 @backstage/config-loader 1.1.6 @backstage/config 1.0.4 @backstage/core-app-api 1.2.0 @backstage/core-components 0.12.0, 0.9.5 @backstage/core-plugin-api 1.1.0 @backstage/dev-utils 1.0.8 @backstage/errors 1.1.3 @backstage/integration-react 1.1.6 @backstage/integration 1.4.0 @backstage/plugin-adr-backend 0.2.3 @backstage/plugin-adr-common 0.2.3 @backstage/plugin-adr 0.2.3 @backstage/plugin-api-docs 0.8.11 @backstage/plugin-app-backend 0.3.38 @backstage/plugin-auth-backend 0.17.1 @backstage/plugin-auth-node 0.2.7 @backstage/plugin-catalog-backend-module-github 0.2.1 @backstage/plugin-catalog-backend 1.5.1 @backstage/plugin-catalog-common 1.0.8 @backstage/plugin-catalog-graph 0.2.23 @backstage/plugin-catalog-import 0.9.1 @backstage/plugin-catalog-node 1.2.1 @backstage/plugin-catalog-react 1.2.1 @backstage/plugin-catalog 1.6.1 @backstage/plugin-cloudbuild 0.3.11 @backstage/plugin-github-actions 0.5.11 @backstage/plugin-home 0.4.27 @backstage/plugin-org 0.6.1 @backstage/plugin-permission-common 0.7.1 @backstage/plugin-permission-node 0.7.1 @backstage/plugin-permission-react 0.4.7 @backstage/plugin-proxy-backend 0.2.32 @backstage/plugin-scaffolder-backend 1.8.0 @backstage/plugin-scaffolder-common 1.2.2 @backstage/plugin-scaffolder 1.8.0 @backstage/plugin-search-backend-module-pg 0.4.2 @backstage/plugin-search-backend-node 1.0.4 @backstage/plugin-search-backend 1.1.1 @backstage/plugin-search-common 1.1.1 @backstage/plugin-search-react 1.2.1 @backstage/plugin-search 1.0.4 @backstage/plugin-stack-overflow 0.1.7 @backstage/plugin-tech-radar 0.5.18 @backstage/plugin-techdocs-backend 1.4.1 @backstage/plugin-techdocs-module-addons-contrib 1.0.6 @backstage/plugin-techdocs-node 1.4.2 @backstage/plugin-techdocs-react 1.0.6 @backstage/plugin-techdocs 1.4.0 @backstage/plugin-user-settings 0.5.1 @backstage/release-manifests 0.0.7 @backstage/test-utils 1.2.2 @backstage/theme 0.2.16 @backstage/types 1.0.1 @backstage/version-bridge 1.0.2

๐Ÿ‘€ Have you spent some time to check if this bug has been raised before?

  • I checked and didnโ€™t find similar issue

๐Ÿข Have you read the Code of Conduct?

Are you willing to submit PR?

No, I donโ€™t have time to work on this right now

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 30 (21 by maintainers)

Most upvoted comments

I think those warnings only show when running locally. They should definitely be fixed, but Iโ€™m fairly certain theyโ€™re not relevant to this issue.

@omartheironman

@agentbellnorm should I open another issue for this?

Please do! ๐Ÿ’ฏ

Regarding the versions you both referred to, Theyโ€™re technically supported since itโ€™s in the version range of the peer dependencies. But I have been able to confirm in the test-repo we created that downgrading to

"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",

indeed produces the error.

Hard to say why, but unless anyone has a valid use case for staying on the beta versions, I agree with closing this issue with the solution being to upgrade react-router and react-router-dom.

Big thanks to everyone for quick responses! ๐Ÿฅ‡

Yes, ours is on

    "react-router": "6.0.0-beta.0",
    "react-router-dom": "6.0.0-beta.0",

When we upgrade to latest, everything is working as expected ๐ŸŽ‰

    "react-router": "^6.4.5",
    "react-router-dom": "^6.4.5",

#15312 Adds backwards compatibility with 6.0.0-beta.0 ๐Ÿ‘

I would like to add that there may be a bug with the version:bump cli then, as weโ€™ve upgraded every minor version available and it somehow missed those dependencies (Iโ€™m assuming the others faced this as well?)

Mine was on

    "react-router": "6.0.0-beta.0",
    "react-router-dom": "6.0.0-beta.0",

Which seems to have been used prior to backstage 1.7.0

for everyone stuck on this, I managed to resolve this by comparing and upgrading my dependancy in package.json

โ€œ@backstage/plugin-techdocsโ€: โ€œ^1.4.0โ€, โ€œ@backstage/plugin-techdocs-module-addons-contribโ€: โ€œ^1.0.6โ€, โ€œ@backstage/plugin-techdocs-reactโ€: โ€œ^1.0.6โ€, โ€œreact-routerโ€: โ€œ6.3.0โ€, โ€œreact-router-domโ€: โ€œ6.3.0โ€

It rendered for me 

Looks like that fixed it for us too. Not sure how that dependency update was missed, we use the command line tool for generating upgrades, looks like it was updated with version 1.7.0.

I just checked our PR for upgrading to 1.7.0 and sure enough, react-router and react-router-dom had no changes.

for everyone stuck on this, I managed to resolve this by comparing and upgrading my dependancy in package.json

โ€œ@backstage/plugin-techdocsโ€: โ€œ^1.4.0โ€, โ€œ@backstage/plugin-techdocs-module-addons-contribโ€: โ€œ^1.0.6โ€, โ€œ@backstage/plugin-techdocs-reactโ€: โ€œ^1.0.6โ€, โ€œreact-routerโ€: โ€œ6.3.0โ€, โ€œreact-router-domโ€: โ€œ6.3.0โ€

It rendered for me 

image

if its any help, the issue happens right here where we seem to be stuck in a loop for sometime until the it we get the error

index.esm.js:290 Uncaught TypeError: Cannot read properties of undefined (reading โ€˜getSelectionโ€™) at HTMLDocument.<anonymous> (index.esm.js:290:43) at H (debounce.js:95:19) at un (debounce.js:144:14) at J (debounce.js:132:14)

@ciprianna can confirm it only works like this:

    <TechDocsAddons>
    </TechDocsAddons>

@ivanaguilario - I experience this issue trying to render any add-on. If I remove Mermaid and leave it with just <ReportIssue /> the page fails to render.