Skip to content

Commit ef94a44

Browse files
hbuchelhibler13Jacob Loganheatheramzjacoblogan
authored
chore(next-release/main): merge in latest from main (aws-amplify#6040)
* Copyedit of Auth guide for sign-in, sign-up, and sign-out * add pr version of link checker script * Updated authenticator callout for react native * convert server to use serve instead of next-start * add static server for testing * update broken link for pr script * update link checker script, add dev mode and pr link checker * update link script * remove unused code * add axios timeout * remove unused command * remove choose filter filtering * update links * correct directory.mjs entry add react-native lib-v1 base page * Update overview.mdx * remove permissions * update pathmap default * GH action to check bundlesize of PR (aws-amplify#5986) * add gh workflow to check bundle size of selected pages * pinning versions * remove unnecessary package * remove errant script from package.json * consolidating functions * change logic for check * fix issues * fix main branch ref --------- Co-authored-by: katiegoines <[email protected]> * adding needed index files * Update csp (aws-amplify#5987) * Remove deprecated prefetch-src header * Update alpha CSP to remove warnings during local testing * update index script * update write script * add missing index files * revert ssg revert * add static generation to new js docs * add static paths to page * remove unlinked and unbuilt pages * adding highlight for CDK support on main page * update pages to match filters and generate the same index files as main * Added What's New Banner * addressed based on Janaina's feedback * Update data-modeling.mdx * update table in fragment to resolve hydration issue * render contribute getting started text in spans * chore(flutter): remove null safety references (aws-amplify#5998) Co-authored-by: Tim Nguyen <[email protected]> * Update versions.ts Updating the android library version * Update-project-setup (aws-amplify#6007) * updated project set up * update framework info * updated project set up * update project set up * Update src/pages/lib-v1/project-setup/create-application/q/platform/[platform].mdx added period * Update src/pages/lib-v1/project-setup/create-application/q/platform/[platform].mdx Co-authored-by: Ashwin Kumar <[email protected]> --------- Co-authored-by: Chris Womack <[email protected]> Co-authored-by: Ashwin Kumar <[email protected]> Co-authored-by: Katie Goines <[email protected]> * chore(deps): bump @aws-amplify/amplify-cli-core from 4.2.7 to 4.2.10 (aws-amplify#6011) Bumps [@aws-amplify/amplify-cli-core](https://github.com/aws-amplify/amplify-cli/tree/HEAD/packages/amplify-cli-core) from 4.2.7 to 4.2.10. - [Release notes](https://github.com/aws-amplify/amplify-cli/releases) - [Changelog](https://github.com/aws-amplify/amplify-cli/blob/@aws-amplify/[email protected]/packages/amplify-cli-core/CHANGELOG.md) - [Commits](https://github.com/aws-amplify/amplify-cli/commits/@aws-amplify/[email protected]/packages/amplify-cli-core) --- updated-dependencies: - dependency-name: "@aws-amplify/amplify-cli-core" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Katie Goines <[email protected]> * Add custom analytics event for the "What's New" banner (aws-amplify#6006) * Add a custom adobe analytics event for the WhatsNewBanner component * Add comment for function * update home page to update page context * fix: updating @babel/traverse (aws-amplify#6025) * update @babel/core and @babel/traverse * updated @babel/traverse --------- Co-authored-by: katiegoines <[email protected]> * update base lib, sdk, and guides pages * update next/previous styles * Amplify Android API Relational Models (aws-amplify#6020) * feat(api): iOS Android API GraphQL relational models pages * update schema * Add callout, update many-to-many schema * update callout to point to migration guide for existing developers * add new sections for query and css * Updates to Android API Relationship page * Defragmented pages and reordered content. * Remove iOS docs for now * Remove iOS docs for now * Remove fragments * Add delete code snippet * Correct description of query --------- Co-authored-by: Michael Law <[email protected]> Co-authored-by: Rene Brandel <[email protected]> * Update CODEOWNERS to exclude documentation team from all files (aws-amplify#6030) * chore: update auth docs now that cdk tokens are supported for adminRole and identityPoolId * Update src/pages/cli/graphql/authorization-rules.mdx * fix: update example naming * Revert "Update CODEOWNERS to exclude documentation team from all files (aws-amplify#6030)" (aws-amplify#6031) * update new page to include ssg required exports * update sample amplifyconfiguration json file (aws-amplify#5874) Co-authored-by: Tim Nguyen <[email protected]> Co-authored-by: Katie Goines <[email protected]> * add choose your filter page * filter out all but android (aws-amplify#6036) Co-authored-by: katiegoines <[email protected]> Co-authored-by: Rene Brandel <[email protected]> * Update Amplify Android Version * revert InternalLink back to next-release/main, needs to be refactored out * fix versions export * Delete some tests for now from components that are going to be removed * Delete some tests for now from components that are going to be removed --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Jim Eagan <[email protected]> Co-authored-by: Jim Eagan <[email protected]> Co-authored-by: Jacob Logan <[email protected]> Co-authored-by: Heather Pundt <[email protected]> Co-authored-by: jacoblogan <[email protected]> Co-authored-by: Rene Brandel <[email protected]> Co-authored-by: Katie Goines <[email protected]> Co-authored-by: katiegoines <[email protected]> Co-authored-by: Tim Nguyen <[email protected]> Co-authored-by: Rene Brandel <[email protected]> Co-authored-by: Dustin Noyes <[email protected]> Co-authored-by: gpanshu <[email protected]> Co-authored-by: Abdallah Shaban <[email protected]> Co-authored-by: Chris Womack <[email protected]> Co-authored-by: Ashwin Kumar <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Roach <[email protected]> Co-authored-by: Michael Law <[email protected]> Co-authored-by: Al Harris <[email protected]> Co-authored-by: Tuan Pham <[email protected]>
1 parent 4892662 commit ef94a44

File tree

774 files changed

+14478
-1810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

774 files changed

+14478
-1810
lines changed
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Check Bundle Size
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
checkBundleSizeChange:
7+
permissions:
8+
pull-requests: read
9+
name: Check whether PR increases bundle size more than 5%
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout main branch
13+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 https://github.com/actions/checkout/commit/f43a0e5ff2bd294095638e18286ca9a3d1956744
14+
with:
15+
ref: main
16+
- name: Setup Node.js 16.x
17+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 https://github.com/actions/setup-node/commit/5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
18+
with:
19+
node-version: 16.x
20+
- name: Install dependencies
21+
run: yarn
22+
- name: Run build and analyze base bundle sizes
23+
env:
24+
CURRENT_BRANCH: ${{ github.base_ref }}
25+
CURRENT_REPO: ${{ github.repository }}
26+
NODE_OPTIONS: --max_old_space_size=4096
27+
run: ANALYZE=true yarn next-build
28+
- name: Check base bundle size of select pages
29+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410
30+
id: base-bundle-sizes
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
script: |
34+
const { checkBundleSize } = require('./.github/workflows/scripts/check_bundle_size.js');
35+
return checkBundleSize();
36+
- name: Checkout PR branch
37+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 https://github.com/actions/checkout/commit/f43a0e5ff2bd294095638e18286ca9a3d1956744
38+
with:
39+
ref: ${{ github.head_ref }}
40+
- name: Setup Node.js 16.x
41+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v.3.8.1 https://github.com/actions/setup-node/commit/5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
42+
with:
43+
node-version: 16.x
44+
- name: Install dependencies
45+
run: yarn
46+
- name: Run build and analyze head bundle sizes
47+
env:
48+
CURRENT_BRANCH: ${{ github.head_ref }}
49+
CURRENT_REPO: ${{ github.repository }}
50+
NODE_OPTIONS: --max_old_space_size=4096
51+
run: ANALYZE=true yarn next-build
52+
- name: Check head bundle size of select pages
53+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410
54+
id: head-bundle-sizes
55+
with:
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
script: |
58+
const { checkBundleSize } = require('./.github/workflows/scripts/check_bundle_size.js');
59+
return checkBundleSize();
60+
- name: Compare bundle page bundle sizes
61+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410
62+
id: compare-bundles
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
script: |
66+
const { compareBundles } = require('./.github/workflows/scripts/check_bundle_size.js');
67+
const baseBundles = ${{ steps.base-bundle-sizes.outputs.result }}
68+
const headBundles = ${{ steps.head-bundle-sizes.outputs.result }}
69+
return await compareBundles(baseBundles, headBundles)
70+
- name: Fail if bundle size growth exceeds 5% on any of the selected pages
71+
if: ${{ steps.compare-bundles.outputs.result > 0 }}
72+
run: exit 1

.github/workflows/check_for_broken_links.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
with:
2525
result-encoding: string
2626
script: |
27-
const { checkLinks } = require('./tasks/link-checker.js');
28-
return await checkLinks();
27+
const { checkProdLinks } = require('./tasks/link-checker.js');
28+
return await checkProdLinks();
2929
- name: Configure AWS Credentials
3030
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
3131
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CheckPRLinks
2+
on:
3+
pull_request:
4+
branches: [main]
5+
types: [opened, synchronize]
6+
jobs:
7+
CheckPRLinks:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 https://github.com/actions/checkout/commit/f43a0e5ff2bd294095638e18286ca9a3d1956744
12+
- name: Setup Node.js 16.x
13+
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 https://github.com/actions/setup-node/commit/e33196f7422957bea03ed53f6fbb155025ffc7b8
14+
with:
15+
node-version: 16.x
16+
- name: Install Dependencies
17+
run: yarn
18+
- name: Run Build
19+
run: yarn build
20+
env:
21+
NODE_OPTIONS: --max_old_space_size=4096
22+
- name: Run Server
23+
run: |
24+
node ./node_modules/.bin/serve client/www/next-build --no-request-logging &
25+
sleep 5
26+
- name: Run Link Checker
27+
id: checkLinks
28+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410
29+
with:
30+
result-encoding: string
31+
script: |
32+
const { checkDevLinks } = require('./tasks/link-checker.js');
33+
return await checkDevLinks();
34+
- name: Fail if broken links have been found
35+
if: ${{ steps.checkLinks.outputs.result }}
36+
run: exit 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module.exports = {
2+
checkBundleSize: () => {
3+
const fs = require('fs');
4+
const jsonString = fs.readFileSync('.github/analyze/bundles.json');
5+
const data = JSON.parse(jsonString);
6+
const pagesToCheck = [
7+
'/',
8+
'/cli/start/install',
9+
'/lib/auth/getting-started/q/platform/[platform]',
10+
'/start',
11+
'/cli'
12+
];
13+
const bundleSizes = [];
14+
data.pages.filter((page) => {
15+
if (pagesToCheck.includes(page.label)) {
16+
bundleSizes.push({
17+
page: page.label,
18+
gzipSize: page.gzipSize,
19+
parsedSize: page.parsedSize,
20+
statSize: page.statSize,
21+
totalGzipSize: page.totalGzipSize,
22+
totalParsedSize: page.totalParsedSize,
23+
totalStatSize: page.totalStatSize
24+
});
25+
}
26+
});
27+
return bundleSizes;
28+
},
29+
30+
compareBundles: (baseBundles, headBundles) => {
31+
const fails = [];
32+
baseBundles.forEach((basePage) => {
33+
headBundles.forEach((headPage) => {
34+
if (
35+
basePage.page == headPage.page &&
36+
basePage.parsedSize * 1.05 < headPage.parsedSize
37+
) {
38+
fails.push(basePage.page);
39+
}
40+
});
41+
});
42+
console.log(
43+
`The bundle size of ${fails} increased by more than 5% with this PR`
44+
);
45+
return fails.length;
46+
}
47+
};

cspell.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,9 @@
15221522
"cloudwatchlogs",
15231523
"userids",
15241524
"xmark",
1525-
"refreshable"
1525+
"refreshable",
1526+
"querytransfers",
1527+
"generatemodelsforlazyloadandcustomselectionset"
15261528
],
15271529
"flagWords": ["hte", "full-stack", "Full-stack", "Full-Stack", "sudo"],
15281530
"patterns": [

customHttp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ customHeaders:
1313
- key: 'X-Content-Type-Options'
1414
value: 'nosniff'
1515
- key: 'Content-Security-Policy'
16-
value: "upgrade-insecure-requests; default-src 'none'; prefetch-src 'self'; style-src 'self' 'unsafe-inline' *.shortbread.aws.dev; font-src 'self'; frame-src 'self' https://www.youtube-nocookie.com https://aws.demdex.net https://dpm.demdex.net; connect-src 'self' *.shortbread.aws.dev https://amazonwebservices.d2.sc.omtrdc.net https://aws.demdex.net https://dpm.demdex.net https://cm.everesttech.net https://a0.awsstatic.com/ https://d2c.aws.amazon.com https://vs.aws.amazon.com https://*.algolia.net https://*.algolianet.com *.amazonaws.com https://aws.amazon.com/ https://d2c-alpha.dse.marketing.aws.a2z.com https://aws-mktg-csds-alpha.integ.amazon.com/ https://alpha.d2c.marketing.aws.dev/ https://aa0.awsstatic.com/; img-src 'self' https://img.shields.io https://amazonwebservices.d2.sc.omtrdc.net https://aws.demdex.net https://dpm.demdex.net https://cm.everesttech.net https://a0.awsstatic.com/ https://alpha.d2c.marketing.aws.dev/ https://aa0.awsstatic.com/; media-src 'self'; script-src 'self' *.shortbread.aws.dev https://a0.awsstatic.com/ https://aa0.awsstatic.com/ https://alpha.d2c.marketing.aws.dev/ https://d2c.aws.amazon.com/;"
16+
value: "upgrade-insecure-requests; default-src 'none'; style-src 'self' 'unsafe-inline' *.shortbread.aws.dev; font-src 'self'; frame-src 'self' https://www.youtube-nocookie.com https://aws.demdex.net https://dpm.demdex.net; connect-src 'self' *.shortbread.aws.dev https://amazonwebservices.d2.sc.omtrdc.net https://aws.demdex.net https://dpm.demdex.net https://cm.everesttech.net https://a0.awsstatic.com/ https://d2c.aws.amazon.com https://vs.aws.amazon.com https://*.algolia.net https://*.algolianet.com *.amazonaws.com https://aws.amazon.com/ https://d2c-alpha.dse.marketing.aws.a2z.com https://aws-mktg-csds-alpha.integ.amazon.com/ https://alpha.d2c.marketing.aws.dev/ https://aa0.awsstatic.com/; img-src 'self' https://img.shields.io https://amazonwebservices.d2.sc.omtrdc.net https://aws.demdex.net https://dpm.demdex.net https://cm.everesttech.net https://a0.awsstatic.com/ https://alpha.d2c.marketing.aws.dev/ https://aa0.awsstatic.com/; media-src 'self'; script-src 'self' *.shortbread.aws.dev https://a0.awsstatic.com/ https://aa0.awsstatic.com/ https://alpha.d2c.marketing.aws.dev/ https://d2c.aws.amazon.com/;"
1717
# CSP also set in _document.tsx meta tag

generatePathMap.cjs.js

+6-24
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ function generatePathMap(
6767
'/lib-v1/q/platform/js': {
6868
page: '/lib-v1/q/platform/[platform]'
6969
},
70+
'/lib-v1/q/platform/react-native': {
71+
page: '/lib-v1/q/platform/[platform]'
72+
},
7073
'/sdk/q/platform/js': {
7174
page: '/sdk/q/platform/[platform]'
7275
},
@@ -79,6 +82,9 @@ function generatePathMap(
7982
'/sdk/q/platform/flutter': {
8083
page: '/sdk/q/platform/[platform]'
8184
},
85+
'/sdk/q/platform/react-native': {
86+
page: '/sdk/q/platform/[platform]'
87+
},
8288
'/console': {
8389
page: '/console'
8490
},
@@ -120,19 +126,6 @@ function generatePathMap(
120126
} else if (route.startsWith('/start')) {
121127
filterKind = 'integration';
122128
}
123-
124-
if (filterKind !== '') {
125-
const aOrAn = 'aeiou'.includes(filterKind[0]) ? 'an' : 'a';
126-
pathMap[route] = {
127-
page: '/ChooseFilterPage',
128-
query: {
129-
address: route,
130-
directoryPath: '/ChooseFilterPage',
131-
filterKind: filterKind,
132-
message: `Choose ${aOrAn} ${filterKind}:`
133-
}
134-
};
135-
}
136129
}
137130

138131
if (items) {
@@ -202,17 +195,6 @@ function generatePathMap(
202195
page: `${route}/q/${routeType}/[${routeType}]`
203196
};
204197
});
205-
const aOrAn = 'aeiou'.includes(routeType[0]) ? 'an' : 'a';
206-
pathMap[route] = {
207-
page: '/ChooseFilterPage',
208-
query: {
209-
address: route,
210-
directoryPath: '/ChooseFilterPage',
211-
filterKind: routeType,
212-
filters: filters,
213-
message: `Choose ${aOrAn} ${routeType}:`
214-
}
215-
};
216198
}
217199
return pathMap;
218200
}

next.config.mjs

+18-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export default async () => {
1616
}
1717
});
1818

19-
const nextConfig = withMDX({
19+
const shouldAnalyzeBundles = process.env.ANALYZE === 'true';
20+
21+
let nextConfig = withMDX({
2022
env: {
2123
BUILD_ENV: process.env.BUILD_ENV,
2224
nextImageExportOptimizer_imageFolderPath: 'public',
@@ -75,5 +77,20 @@ export default async () => {
7577
];
7678
}
7779
});
80+
81+
if (shouldAnalyzeBundles) {
82+
// eslint-disable-next-line @typescript-eslint/no-var-requires
83+
const withNextBundleAnalyzer = require('next-bundle-analyzer')({
84+
format: ['json'],
85+
reportDir: '../.github/analyze',
86+
json: {
87+
filter: {
88+
pages: true
89+
}
90+
}
91+
});
92+
nextConfig = withNextBundleAnalyzer(nextConfig);
93+
}
94+
7895
return nextConfig;
7996
};

package.json

+15-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@algolia/autocomplete-shared": "^1.5.6",
1616
"@algolia/autocomplete-theme-classic": "^1.6.1",
1717
"@algolia/client-search": "^4.13.0",
18-
"@aws-amplify/amplify-cli-core": "^4.2.7",
18+
"@aws-amplify/amplify-cli-core": "^4.2.10",
1919
"@aws-amplify/ui-react": "^5.3.1",
2020
"@emotion/react": "^11.1.5",
2121
"@emotion/styled": "^11.3.0",
@@ -28,6 +28,7 @@
2828
"aws-amplify": "^5.0.5",
2929
"classnames": "^2.3.2",
3030
"copy-to-clipboard": "^3.2.1",
31+
"cross-env": "^7.0.3",
3132
"dotenv": "^16.0.0",
3233
"emotion": "^10.0.23",
3334
"eslint-config-next": "^13.2.4",
@@ -58,6 +59,7 @@
5859
},
5960
"devDependencies": {
6061
"@next/mdx": "^13.5.4",
62+
"@next/bundle-analyzer": "^13.5.3",
6163
"@stencil/core": "^1.17.0",
6264
"@stencil/eslint-plugin": "^0.2.1",
6365
"@stencil/router": "^1.0.1",
@@ -85,9 +87,11 @@
8587
"jest": "^26.6.3",
8688
"jest-cli": "^26.6.3",
8789
"prettier": "^3.0.3",
90+
"next-bundle-analyzer": "^0.6.7",
8891
"puppeteer": "^20.8.2",
8992
"rollup-plugin-node-polyfills": "^0.2.1",
9093
"sass": "^1.54.8",
94+
"serve": "^14.2.1",
9195
"tiny-glob": "0.2.9",
9296
"ts-jest": "^26.0.3",
9397
"ts-node": "^8.5.0",
@@ -96,6 +100,8 @@
96100
},
97101
"resolutions": {
98102
"**/trim": "0.0.3",
103+
"@babel/core": "^7.23.2",
104+
"@babel/traverse": "^7.23.2",
99105
"loader-utils": "2.0.4",
100106
"minimatch": "3.1.2",
101107
"json5": "2.2.2",
@@ -127,7 +133,11 @@
127133
],
128134
"setupFilesAfterEnv": [
129135
"<rootDir>/jest.setup.js"
130-
]
136+
],
137+
"moduleNameMapper": {
138+
"\\.(css|less|scss)$": "<rootDir>/src/__mocks__/styleMock.js"
139+
},
140+
"transformIgnorePatterns": []
131141
},
132142
"scripts": {
133143
"clean": "rm -rf node_modules yarn.lock",
@@ -140,6 +150,8 @@
140150
"build:release": "yarn build && next-image-export-optimizer --exportFolderPath client/www/next-build",
141151
"next-build": "next build",
142152
"next-start": "next start",
143-
"prepare": "husky install"
153+
"amplify:submissionsLambda": "cd amplify/backend/function/submissionsLambda/src && yarn install && yarn build && yarn test",
154+
"prepare": "husky install",
155+
"analyze": "ANALYZE=true yarn next-build"
144156
}
145157
}

src/__mocks__/styleMock.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

src/components/Accordion/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ const Accordion: React.FC<AccordionProps> = ({
2020
const [expandedHeight, setExpandedHeight] = useState(0);
2121
const docsExpander = useRef<HTMLElement>(null);
2222

23+
let pathName = '';
24+
if (typeof window !== 'undefined') {
25+
pathName = window.location.pathname;
26+
}
27+
2328
useEffect(() => {
2429
const expander = docsExpander.current;
2530

@@ -62,7 +67,7 @@ const Accordion: React.FC<AccordionProps> = ({
6267

6368
const anchor = createElement(
6469
'a',
65-
{ href: window.location.pathname + '#' + headingId },
70+
{ href: pathName + '#' + headingId },
6671
expanderTitle
6772
);
6873

0 commit comments

Comments
 (0)