@backstage/plugin-techdocs 0.0.0-nightly-20240712021724 → 0.0.0-nightly-20240714022233

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,21 +1,22 @@
1
1
  # @backstage/plugin-techdocs
2
2
 
3
- ## 0.0.0-nightly-20240712021724
3
+ ## 0.0.0-nightly-20240714022233
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 8fc2622: Fixed an issue that was causing techdocs pages unnecessarily re-render on navigate.
7
8
  - 6fa652c: Improve default sorting of docs table
8
9
  - 60caa92: Fix double scrollbar bug in reader
9
10
  - Updated dependencies
10
- - @backstage/plugin-techdocs-react@0.0.0-nightly-20240712021724
11
- - @backstage/core-components@0.0.0-nightly-20240712021724
12
- - @backstage/integration@0.0.0-nightly-20240712021724
13
- - @backstage/plugin-catalog-react@0.0.0-nightly-20240712021724
14
- - @backstage/frontend-plugin-api@0.0.0-nightly-20240712021724
15
- - @backstage/integration-react@0.0.0-nightly-20240712021724
16
- - @backstage/plugin-auth-react@0.0.0-nightly-20240712021724
17
- - @backstage/plugin-search-react@0.0.0-nightly-20240712021724
18
- - @backstage/core-compat-api@0.0.0-nightly-20240712021724
11
+ - @backstage/plugin-techdocs-react@0.0.0-nightly-20240714022233
12
+ - @backstage/core-components@0.0.0-nightly-20240714022233
13
+ - @backstage/integration@0.0.0-nightly-20240714022233
14
+ - @backstage/plugin-catalog-react@0.0.0-nightly-20240714022233
15
+ - @backstage/frontend-plugin-api@0.0.0-nightly-20240714022233
16
+ - @backstage/integration-react@0.0.0-nightly-20240714022233
17
+ - @backstage/plugin-auth-react@0.0.0-nightly-20240714022233
18
+ - @backstage/plugin-search-react@0.0.0-nightly-20240714022233
19
+ - @backstage/core-compat-api@0.0.0-nightly-20240714022233
19
20
  - @backstage/core-plugin-api@1.9.3
20
21
  - @backstage/catalog-model@1.5.0
21
22
  - @backstage/config@1.2.0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs__alpha",
3
- "version": "0.0.0-nightly-20240712021724",
3
+ "version": "0.0.0-nightly-20240714022233",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -1,5 +1,5 @@
1
1
  import { useApi, configApiRef } from '@backstage/core-plugin-api';
2
- import { useCallback } from 'react';
2
+ import { useRef, useCallback } from 'react';
3
3
  import { useNavigate } from 'react-router-dom';
4
4
 
5
5
  function resolveUrlToRelative(url, baseUrl) {
@@ -13,7 +13,7 @@ function resolveUrlToRelative(url, baseUrl) {
13
13
  return `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`;
14
14
  }
15
15
  function useNavigateUrl() {
16
- const navigate = useNavigate();
16
+ const navigate = useRef(useNavigate());
17
17
  const configApi = useApi(configApiRef);
18
18
  const appBaseUrl = configApi.getOptionalString("app.baseUrl");
19
19
  const navigateFn = useCallback(
@@ -25,9 +25,9 @@ function useNavigateUrl() {
25
25
  } catch (err) {
26
26
  }
27
27
  }
28
- navigate(url);
28
+ navigate.current(url);
29
29
  },
30
- [navigate, appBaseUrl]
30
+ [appBaseUrl]
31
31
  );
32
32
  return navigateFn;
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigateUrl.esm.js","sources":["../../../../src/reader/components/TechDocsReaderPageContent/useNavigateUrl.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\n/**\n * Resolve a URL to a relative URL given a base URL that may or may not include subpaths.\n * @param url - URL to parse into a relative url based on the baseUrl.\n * @param baseUrl - Application base url, where the application is currently hosted.\n * @returns relative path without any subpaths from website config.\n */\nexport function resolveUrlToRelative(url: string, baseUrl: string) {\n const parsedAppUrl = new URL(baseUrl);\n const appUrlPath = `${parsedAppUrl.origin}${parsedAppUrl.pathname.replace(\n /\\/$/,\n '',\n )}`;\n\n const relativeUrl = url\n .replace(appUrlPath, '')\n // Remove any leading slashes.\n .replace(/^\\/+/, '');\n const parsedUrl = new URL(`http://localhost/${relativeUrl}`);\n return `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`;\n}\n\n/**\n * A helper hook that allows for full internal website urls to be processed through the navigate\n * hook provided by `react-router-dom`.\n *\n * NOTE: This does not support routing to external URLs. That should be done with a `Link` or `a`\n * element instead, or just `window.location.href`.\n *\n * TODO: Update this to use `useRouteRef` instead of `useApi`.\n *\n * @returns Navigation function that is a wrapper over `react-router-dom`'s\n * to support passing full URLs for navigation.\n *\n * @public\n */\nexport function useNavigateUrl() {\n const navigate = useNavigate();\n const configApi = useApi(configApiRef);\n const appBaseUrl = configApi.getOptionalString('app.baseUrl');\n const navigateFn = useCallback(\n (to: string) => {\n let url = to;\n /**\n * This should always be true when running the application, this just allows\n * test cases that do not have the configApi set up to run still.\n */\n if (appBaseUrl) {\n try {\n url = resolveUrlToRelative(to, appBaseUrl);\n } catch (err) {\n // URL passed in was relative.\n }\n }\n navigate(url);\n },\n [navigate, appBaseUrl],\n );\n return navigateFn;\n}\n"],"names":[],"mappings":";;;;AAyBgB,SAAA,oBAAA,CAAqB,KAAa,OAAiB,EAAA;AACjE,EAAM,MAAA,YAAA,GAAe,IAAI,GAAA,CAAI,OAAO,CAAA,CAAA;AACpC,EAAA,MAAM,aAAa,CAAG,EAAA,YAAA,CAAa,MAAM,CAAA,EAAG,aAAa,QAAS,CAAA,OAAA;AAAA,IAChE,KAAA;AAAA,IACA,EAAA;AAAA,GACD,CAAA,CAAA,CAAA;AAED,EAAM,MAAA,WAAA,GAAc,IACjB,OAAQ,CAAA,UAAA,EAAY,EAAE,CAEtB,CAAA,OAAA,CAAQ,QAAQ,EAAE,CAAA,CAAA;AACrB,EAAA,MAAM,SAAY,GAAA,IAAI,GAAI,CAAA,CAAA,iBAAA,EAAoB,WAAW,CAAE,CAAA,CAAA,CAAA;AAC3D,EAAO,OAAA,CAAA,EAAG,UAAU,QAAQ,CAAA,EAAG,UAAU,MAAM,CAAA,EAAG,UAAU,IAAI,CAAA,CAAA,CAAA;AAClE,CAAA;AAgBO,SAAS,cAAiB,GAAA;AAC/B,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,EAAM,MAAA,UAAA,GAAa,SAAU,CAAA,iBAAA,CAAkB,aAAa,CAAA,CAAA;AAC5D,EAAA,MAAM,UAAa,GAAA,WAAA;AAAA,IACjB,CAAC,EAAe,KAAA;AACd,MAAA,IAAI,GAAM,GAAA,EAAA,CAAA;AAKV,MAAA,IAAI,UAAY,EAAA;AACd,QAAI,IAAA;AACF,UAAM,GAAA,GAAA,oBAAA,CAAqB,IAAI,UAAU,CAAA,CAAA;AAAA,iBAClC,GAAK,EAAA;AAAA,SAEd;AAAA,OACF;AACA,MAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AAAA,KACd;AAAA,IACA,CAAC,UAAU,UAAU,CAAA;AAAA,GACvB,CAAA;AACA,EAAO,OAAA,UAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"useNavigateUrl.esm.js","sources":["../../../../src/reader/components/TechDocsReaderPageContent/useNavigateUrl.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useCallback, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\n/**\n * Resolve a URL to a relative URL given a base URL that may or may not include subpaths.\n * @param url - URL to parse into a relative url based on the baseUrl.\n * @param baseUrl - Application base url, where the application is currently hosted.\n * @returns relative path without any subpaths from website config.\n */\nexport function resolveUrlToRelative(url: string, baseUrl: string) {\n const parsedAppUrl = new URL(baseUrl);\n const appUrlPath = `${parsedAppUrl.origin}${parsedAppUrl.pathname.replace(\n /\\/$/,\n '',\n )}`;\n\n const relativeUrl = url\n .replace(appUrlPath, '')\n // Remove any leading slashes.\n .replace(/^\\/+/, '');\n const parsedUrl = new URL(`http://localhost/${relativeUrl}`);\n return `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`;\n}\n\n/**\n * A helper hook that allows for full internal website urls to be processed through the navigate\n * hook provided by `react-router-dom`.\n *\n * NOTE: This does not support routing to external URLs. That should be done with a `Link` or `a`\n * element instead, or just `window.location.href`.\n *\n * TODO: Update this to use `useRouteRef` instead of `useApi`.\n *\n * @returns Navigation function that is a wrapper over `react-router-dom`'s\n * to support passing full URLs for navigation.\n *\n * @public\n */\nexport function useNavigateUrl() {\n // useRef prevents useNavigate from causing unnecessary re-renders\n const navigate = useRef(useNavigate());\n const configApi = useApi(configApiRef);\n const appBaseUrl = configApi.getOptionalString('app.baseUrl');\n const navigateFn = useCallback(\n (to: string) => {\n let url = to;\n /**\n * This should always be true when running the application, this just allows\n * test cases that do not have the configApi set up to run still.\n */\n if (appBaseUrl) {\n try {\n url = resolveUrlToRelative(to, appBaseUrl);\n } catch (err) {\n // URL passed in was relative.\n }\n }\n navigate.current(url);\n },\n [appBaseUrl],\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,CAAA;AACA,EAAO,OAAA,UAAA,CAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs",
3
- "version": "0.0.0-nightly-20240712021724",
3
+ "version": "0.0.0-nightly-20240714022233",
4
4
  "description": "The Backstage plugin that renders technical documentation for your components",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -59,18 +59,18 @@
59
59
  "dependencies": {
60
60
  "@backstage/catalog-model": "^1.5.0",
61
61
  "@backstage/config": "^1.2.0",
62
- "@backstage/core-compat-api": "^0.0.0-nightly-20240712021724",
63
- "@backstage/core-components": "^0.0.0-nightly-20240712021724",
62
+ "@backstage/core-compat-api": "^0.0.0-nightly-20240714022233",
63
+ "@backstage/core-components": "^0.0.0-nightly-20240714022233",
64
64
  "@backstage/core-plugin-api": "^1.9.3",
65
65
  "@backstage/errors": "^1.2.4",
66
- "@backstage/frontend-plugin-api": "^0.0.0-nightly-20240712021724",
67
- "@backstage/integration": "^0.0.0-nightly-20240712021724",
68
- "@backstage/integration-react": "^0.0.0-nightly-20240712021724",
69
- "@backstage/plugin-auth-react": "^0.0.0-nightly-20240712021724",
70
- "@backstage/plugin-catalog-react": "^0.0.0-nightly-20240712021724",
66
+ "@backstage/frontend-plugin-api": "^0.0.0-nightly-20240714022233",
67
+ "@backstage/integration": "^0.0.0-nightly-20240714022233",
68
+ "@backstage/integration-react": "^0.0.0-nightly-20240714022233",
69
+ "@backstage/plugin-auth-react": "^0.0.0-nightly-20240714022233",
70
+ "@backstage/plugin-catalog-react": "^0.0.0-nightly-20240714022233",
71
71
  "@backstage/plugin-search-common": "^1.2.12",
72
- "@backstage/plugin-search-react": "^0.0.0-nightly-20240712021724",
73
- "@backstage/plugin-techdocs-react": "^0.0.0-nightly-20240712021724",
72
+ "@backstage/plugin-search-react": "^0.0.0-nightly-20240714022233",
73
+ "@backstage/plugin-techdocs-react": "^0.0.0-nightly-20240714022233",
74
74
  "@backstage/theme": "^0.5.6",
75
75
  "@material-ui/core": "^4.12.2",
76
76
  "@material-ui/icons": "^4.9.1",
@@ -86,11 +86,11 @@
86
86
  "react-use": "^17.2.4"
87
87
  },
88
88
  "devDependencies": {
89
- "@backstage/cli": "^0.0.0-nightly-20240712021724",
90
- "@backstage/core-app-api": "^0.0.0-nightly-20240712021724",
91
- "@backstage/dev-utils": "^0.0.0-nightly-20240712021724",
92
- "@backstage/plugin-techdocs-module-addons-contrib": "^0.0.0-nightly-20240712021724",
93
- "@backstage/test-utils": "^0.0.0-nightly-20240712021724",
89
+ "@backstage/cli": "^0.0.0-nightly-20240714022233",
90
+ "@backstage/core-app-api": "^0.0.0-nightly-20240714022233",
91
+ "@backstage/dev-utils": "^0.0.0-nightly-20240714022233",
92
+ "@backstage/plugin-techdocs-module-addons-contrib": "^0.0.0-nightly-20240714022233",
93
+ "@backstage/test-utils": "^0.0.0-nightly-20240714022233",
94
94
  "@testing-library/dom": "^10.0.0",
95
95
  "@testing-library/jest-dom": "^6.0.0",
96
96
  "@testing-library/react": "^15.0.0",