Skip to content

Commit 17ff8cb

Browse files
authored
Merge pull request #25527 from github/repo-sync
repo sync
2 parents 24244d1 + e16bda2 commit 17ff8cb

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/webhooks/pages/webhook-events-and-payloads.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,17 @@ export default function WebhooksEventsAndPayloads({
3939
// we don't want the URL to be ?actionType=closed#fork).
4040
useEffect(() => {
4141
const hashChangeHandler = () => {
42-
const { asPath } = router
43-
let [pathRoot, pathQuery = ''] = asPath.split('?')
44-
45-
if (pathRoot.includes('#')) {
46-
pathRoot = pathRoot.split('#')[0]
47-
}
42+
const { pathname, hash, search } = window.location
4843

4944
// carry over any other query parameters besides `actionType` for the webhook
5045
// action type
51-
if (pathQuery.includes('#')) {
52-
pathQuery = pathQuery.split('#')[0]
53-
}
54-
const params = new URLSearchParams(pathQuery)
46+
const params = new URLSearchParams(search)
5547
params.delete('actionType')
5648

57-
if (location.hash) {
58-
router.replace(
59-
{ pathname: pathRoot, query: params.toString(), hash: location.hash },
60-
undefined,
61-
{
62-
shallow: true,
63-
locale,
64-
}
65-
)
49+
if (hash) {
50+
router.replace({ pathname, query: params.toString(), hash }, undefined, {
51+
shallow: true,
52+
})
6653
}
6754
}
6855

0 commit comments

Comments
 (0)