Skip to content

Commit

Permalink
Remove unnecesery catch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Apr 24, 2023
1 parent 277d5c8 commit 1d1b84a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions docs/src/modules/components/ComponentsApiContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,16 @@ export default function ComponentsApiContent(props) {
// This effects makes sure that the anchors will be correct wtih the renames
React.useEffect(() => {
const anchor = router.asPath.indexOf('#') >= 0 ? router.asPath.split('#')[1] : null;
if (router.isReady && anchor && anchor.endsWith('unstyled')) {
router
.replace(
{
hash: `${anchor.slice(0, -'-unstyled'.length)}`,
},
null,
{
shallow: true,
},
)
// Added because of https://github.com/vercel/next.js/issues/37362
.catch(() => {});
if (router.isReady && anchor && anchor.indexOf('-unstyled') >= 0) {
router.replace(
{
hash: `${anchor.replace('-unstyled', '')}`,
},
null,
{
shallow: true,
},
);
}
}, [router]);

Expand Down

0 comments on commit 1d1b84a

Please sign in to comment.