1
0
mirror of synced 2026-01-07 09:01:31 -05:00

Merge branch 'main' into repo-sync

This commit is contained in:
Octomerger Bot
2022-10-17 06:10:46 -07:00
committed by GitHub
2 changed files with 7 additions and 5 deletions

View File

@@ -11,7 +11,11 @@ export default function ClientSideRefresh() {
useSWR(
router.asPath,
() => {
router.replace(router.asPath, undefined, { scroll: false })
// Remember, in NextJS, the `router.locale` is never including the
// `router.asPath`. So we have to make sure it's always there
// otherwise, after this hook runs, you lose that `/en` prefix
// in the URL on the address bar.
router.replace(`/${router.locale}${router.asPath}`, undefined, { scroll: false })
},
{
// Implied here is that `revalidateOnFocus: true` which the default

View File

@@ -12,15 +12,13 @@ type Props = {
export const TableOfContents = (props: Props) => {
const { items, variant = 'expanded' } = props
const actionItems = (items || []).filter((item) => typeof item !== 'undefined')
return (
<ul
data-testid="table-of-contents"
className={cx(variant === 'compact' ? 'list-style-outside pl-2' : '')}
>
{variant === 'expanded' &&
actionItems.map((item) => {
items.map((item) => {
const { fullPath: href, title, intro } = item
return (
@@ -43,7 +41,7 @@ export const TableOfContents = (props: Props) => {
{variant === 'compact' && (
<ActionList>
{actionItems.map((item) => {
{items.map((item) => {
const { fullPath: href, title, childTocItems } = item
return (
<React.Fragment key={href}>