Skip to content

Commit 69cb208

Browse files
committed
Update development environment and enhance Link component behavior
- Set `STACK_ARTIFICIAL_DEVELOPMENT_DELAY_MS` to 0 in the development environment for immediate feedback during development. - Added `prefetch` prop to the `Link` component, allowing control over prefetching behavior. Updated usages in `UserIdentityCell` to disable prefetching for specific links. This change improves the development experience and optimizes link behavior in the dashboard.
1 parent 8f0f9ff commit 69cb208

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

apps/backend/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ STACK_SVIX_API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NTUxNDA2Mzks
6969
# Set to "vercel", "cloudflare", or leave empty/unset for no proxy trust.
7070
STACK_TRUSTED_PROXY=
7171

72-
STACK_ARTIFICIAL_DEVELOPMENT_DELAY_MS=500
72+
STACK_ARTIFICIAL_DEVELOPMENT_DELAY_MS=0
7373

7474
STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING=yes
7575

apps/dashboard/src/components/data-table/user-table.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ function UserIdentityCell(props: { user: ExtendedServerUser }) {
438438

439439
return (
440440
<div className="flex items-center gap-3">
441-
<Link href={profileUrl} className="rounded-full shrink-0">
441+
<Link href={profileUrl} className="rounded-full shrink-0" prefetch={false}>
442442
<Avatar className="h-6 w-6">
443443
<AvatarImage src={user.profileImageUrl ?? undefined} alt={user.displayName ?? user.primaryEmail ?? "User avatar"} />
444444
<AvatarFallback>{fallback}</AvatarFallback>
@@ -448,6 +448,7 @@ function UserIdentityCell(props: { user: ExtendedServerUser }) {
448448
<Link
449449
href={profileUrl}
450450
className="block truncate text-sm font-semibold text-foreground hover:text-foreground"
451+
prefetch={false}
451452
title={displayName}
452453
>
453454
{displayName}

apps/dashboard/src/components/link.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ type LinkProps = {
1919
title?: string,
2020
};
2121

22-
export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(({ onClick, href, children, ...rest }, ref) => {
22+
export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(({ onClick, href, children, prefetch, ...rest }, ref) => {
2323
const router = useRouter();
2424
const { needConfirm } = useRouterConfirm();
2525

2626
return <NextLink
2727
ref={ref}
2828
href={href}
29+
prefetch={prefetch}
2930
{...rest}
3031
onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {
3132
if (needConfirm) {
@@ -38,7 +39,7 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(({ onClick, h
3839
}
3940
}}
4041
>
41-
<UrlPrefetcher href={href} />
42+
{prefetch === false ? null : <UrlPrefetcher href={href} />}
4243
{children}
4344
</NextLink>;
4445

0 commit comments

Comments
 (0)