Merge branch 'main' into repo-sync
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user