Skip to content

Commit

Permalink
add test error to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
zchsh committed Jul 26, 2024
1 parent 680b142 commit 64a430a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/components/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: MPL-2.0
*/

import React, { ReactElement } from 'react'
import React, { ReactElement, useEffect } from 'react'
import { useRouter } from 'next/router'
import classNames from 'classnames'
import { IconExternalLink16 } from '@hashicorp/flight-icons/svg-react/external-link-16'
Expand Down Expand Up @@ -70,13 +70,21 @@ const FOOTER_ITEMS: FooterItem[] = [
},
]

function Footer({
openConsentManager,
className,
}: FooterProps): React.ReactElement {
function Footer({ openConsentManager, className }: FooterProps): ReactElement {
const { pathname } = useRouter()
const shouldRenderThemeSwitcher = isThemedPath(pathname)

/**
* TODO: this is an error used to test source maps.
* It should be removed before source maps work ends up on main.
*/
useEffect(() => {
const timer = setTimeout(() => {
throw new Error('This is a test error thrown after 3 seconds')
}, 3000)
return () => clearTimeout(timer) // Cleanup the timer on component unmount
}, [])

return (
<footer
className={classNames(
Expand Down

0 comments on commit 64a430a

Please sign in to comment.