mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
fix: don't prefetch as links enter viewport
This commit is contained in:
@@ -15,7 +15,7 @@ export function HyperlinkedText({ tokens }: { tokens: TokenDocumentation[] }) {
|
||||
{tokens.map((token, idx) => {
|
||||
if (token.path) {
|
||||
return (
|
||||
<Link key={idx} href={token.path} passHref>
|
||||
<Link key={idx} href={token.path} passHref prefetch={false}>
|
||||
<Anchor component="a" inherit>
|
||||
{token.text}
|
||||
</Anchor>
|
||||
|
||||
@@ -6,7 +6,7 @@ export function InheritanceText({ data }: { data: InheritanceData }) {
|
||||
return (
|
||||
<Text weight={600}>
|
||||
{'Inherited from '}
|
||||
<Link href={data.path} passHref>
|
||||
<Link href={data.path} passHref prefetch={false}>
|
||||
<Anchor component="a" className="font-mono">
|
||||
{data.parentName}
|
||||
</Anchor>
|
||||
|
||||
@@ -116,7 +116,7 @@ export function SidebarItems({
|
||||
.map((group, idx) => (
|
||||
<Section key={idx} title={group} icon={resolveIcon(group)}>
|
||||
{groupItems[group].map((member, i) => (
|
||||
<Link key={i} href={member.path} passHref>
|
||||
<Link key={i} href={member.path} passHref prefetch={false}>
|
||||
<NavLink
|
||||
className={classes.link}
|
||||
component="a"
|
||||
|
||||
@@ -195,7 +195,7 @@ export function SidebarLayout({
|
||||
const breadcrumbs = useMemo(
|
||||
() =>
|
||||
asPathWithoutQueryAndAnchor.split('/').map((path, idx, original) => (
|
||||
<Link key={idx} href={original.slice(0, idx + 1).join('/')} passHref>
|
||||
<Link key={idx} href={original.slice(0, idx + 1).join('/')} passHref prefetch={false}>
|
||||
<Anchor component="a" sx={(theme) => ({ color: theme.colorScheme === 'dark' ? theme.white : theme.black })}>
|
||||
{path}
|
||||
</Anchor>
|
||||
@@ -317,7 +317,7 @@ export function SidebarLayout({
|
||||
</MediaQuery>
|
||||
</Box>
|
||||
<Group>
|
||||
<Link href="https://github.com/discordjs/discord.js" passHref>
|
||||
<Link href="https://github.com/discordjs/discord.js" passHref prefetch={false}>
|
||||
<ActionIcon
|
||||
component="a"
|
||||
target="_blank"
|
||||
@@ -356,7 +356,7 @@ export function SidebarLayout({
|
||||
>
|
||||
<Container>
|
||||
<Box className={classes.links}>
|
||||
<Link href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss" passHref>
|
||||
<Link href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss" prefetch={false}>
|
||||
<a title="Vercel">
|
||||
<Image
|
||||
src="/powered-by-vercel.svg"
|
||||
@@ -371,12 +371,12 @@ export function SidebarLayout({
|
||||
<Stack spacing={8}>
|
||||
<Title order={4}>Community</Title>
|
||||
<Stack spacing={0}>
|
||||
<Link href="https://discord.gg/djs" passHref>
|
||||
<Link href="https://discord.gg/djs" passHref prefetch={false}>
|
||||
<Anchor component="a" target="_blank" rel="noopener noreferrer" className={classes.link}>
|
||||
Discord
|
||||
</Anchor>
|
||||
</Link>
|
||||
<Link href="https://github.com/discordjs/discord.js/discussions" passHref>
|
||||
<Link href="https://github.com/discordjs/discord.js/discussions" passHref prefetch={false}>
|
||||
<Anchor component="a" target="_blank" rel="noopener noreferrer" className={classes.link}>
|
||||
GitHub discussions
|
||||
</Anchor>
|
||||
@@ -386,17 +386,17 @@ export function SidebarLayout({
|
||||
<Stack spacing={8}>
|
||||
<Title order={4}>Project</Title>
|
||||
<Stack spacing={0}>
|
||||
<Link href="https://github.com/discordjs/discord.js" passHref>
|
||||
<Link href="https://github.com/discordjs/discord.js" passHref prefetch={false}>
|
||||
<Anchor component="a" target="_blank" rel="noopener noreferrer" className={classes.link}>
|
||||
discord.js
|
||||
</Anchor>
|
||||
</Link>
|
||||
<Link href="https://discordjs.guide" passHref>
|
||||
<Link href="https://discordjs.guide" passHref prefetch={false}>
|
||||
<Anchor component="a" target="_blank" rel="noopener noreferrer" className={classes.link}>
|
||||
discord.js guide
|
||||
</Anchor>
|
||||
</Link>
|
||||
<Link href="https://discord-api-types.dev" passHref>
|
||||
<Link href="https://discord-api-types.dev" passHref prefetch={false}>
|
||||
<Anchor component="a" target="_blank" rel="noopener noreferrer" className={classes.link}>
|
||||
discord-api-types
|
||||
</Anchor>
|
||||
|
||||
@@ -41,7 +41,7 @@ export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element {
|
||||
|
||||
if (codeDestination) {
|
||||
return (
|
||||
<Link key={idx} href={codeDestination.path} passHref>
|
||||
<Link key={idx} href={codeDestination.path} passHref prefetch={false}>
|
||||
<Anchor component="a" className="font-mono">
|
||||
{text ?? codeDestination.name}
|
||||
</Anchor>
|
||||
@@ -51,7 +51,7 @@ export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element {
|
||||
|
||||
if (urlDestination) {
|
||||
return (
|
||||
<Link key={idx} href={urlDestination} passHref>
|
||||
<Link key={idx} href={urlDestination} passHref prefetch={false}>
|
||||
<Anchor component="a" className="font-mono">
|
||||
{text ?? urlDestination}
|
||||
</Anchor>
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function FourOhFourPage() {
|
||||
<Box className={classes.label}>404</Box>
|
||||
<Title align="center">Not found.</Title>
|
||||
<Group position="center">
|
||||
<Link href="/docs/packages" passHref>
|
||||
<Link href="/docs/packages" passHref prefetch={false}>
|
||||
<Button component="a" variant="filled" size="md" mt="xl">
|
||||
Take me back
|
||||
</Button>
|
||||
|
||||
@@ -107,7 +107,7 @@ export default function VersionsRoute(props: Partial<VersionProps> & { error?: s
|
||||
Select a version:
|
||||
</Title>
|
||||
{props.data?.versions.map((version) => (
|
||||
<Link key={version} href={`/docs/packages/${props.packageName!}/${version}`} passHref>
|
||||
<Link key={version} href={`/docs/packages/${props.packageName!}/${version}`} passHref prefetch={false}>
|
||||
<UnstyledButton className={classes.control} component="a">
|
||||
<Group position="apart">
|
||||
<Group>
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function PackagesRoute() {
|
||||
Select a package:
|
||||
</Title>
|
||||
{PACKAGES.map((pkg) => (
|
||||
<Link key={pkg} href={`/docs/packages/${pkg}`} passHref>
|
||||
<Link key={pkg} href={`/docs/packages/${pkg}`} passHref prefetch={false}>
|
||||
<UnstyledButton className={classes.control} component="a">
|
||||
<Group position="apart">
|
||||
<Group>
|
||||
|
||||
@@ -76,12 +76,12 @@ export default function IndexRoute() {
|
||||
</Text>
|
||||
|
||||
<Group mt={30}>
|
||||
<Link href="/docs" passHref>
|
||||
<Link href="/docs" passHref prefetch={false}>
|
||||
<Button component="a" radius="sm" size="md">
|
||||
Docs
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href="https://discordjs.guide" passHref>
|
||||
<Link href="https://discordjs.guide" passHref prefetch={false}>
|
||||
<Button component="a" variant="default" radius="sm" size="md" rightIcon={<FiExternalLink />}>
|
||||
Guide
|
||||
</Button>
|
||||
@@ -116,7 +116,7 @@ await client.login('token');`}
|
||||
</Box>
|
||||
</Box>
|
||||
<Center>
|
||||
<Link href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss">
|
||||
<Link href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss" prefetch={false}>
|
||||
<a title="Vercel">
|
||||
<Image
|
||||
src="/powered-by-vercel.svg"
|
||||
|
||||
Reference in New Issue
Block a user