From aa7b14dd2d3ecfaafd75514e8358dcabfd629277 Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Fri, 20 Dec 2024 16:19:59 +0100 Subject: [PATCH] [front] use href prefetch (#9577) --- front/components/UserMenu.tsx | 17 ++++++----------- front/components/app/RootLayout.tsx | 3 +++ front/package-lock.json | 8 ++++---- front/package.json | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/front/components/UserMenu.tsx b/front/components/UserMenu.tsx index 1cee8476854f..dd52c380acb2 100644 --- a/front/components/UserMenu.tsx +++ b/front/components/UserMenu.tsx @@ -90,20 +90,16 @@ export function UserMenu({ { - void router.push( - `/w/${owner.sId}/assistant/labs/transcripts` - ); - }} + href={`/w/${owner.sId}/assistant/labs/transcripts`} + prefetch={false} /> )} {featureFlags.includes("labs_trackers") && ( { - void router.push(`/w/${owner.sId}/assistant/labs/trackers`); - }} + href={`/w/${owner.sId}/assistant/labs/trackers`} + prefetch={false} /> )} @@ -153,11 +149,10 @@ export function UserMenu({ { - void router.push("/api/auth/logout"); - }} + href="/api/auth/logout" icon={LogoutIcon} label="Sign out" + prefetch={false} /> diff --git a/front/components/app/RootLayout.tsx b/front/components/app/RootLayout.tsx index b22bbcfe2589..5767e92b1003 100644 --- a/front/components/app/RootLayout.tsx +++ b/front/components/app/RootLayout.tsx @@ -20,6 +20,7 @@ function NextLinkWrapper({ onClick, replace = false, shallow = false, + prefetch, target = "_self", rel, }: { @@ -39,6 +40,7 @@ function NextLinkWrapper({ onClick?: (event: MouseEvent) => void; replace?: boolean; shallow?: boolean; + prefetch?: boolean; target?: string; rel?: string; }) { @@ -53,6 +55,7 @@ function NextLinkWrapper({ rel={rel} shallow={shallow} replace={replace} + prefetch={prefetch} > {children} diff --git a/front/package-lock.json b/front/package-lock.json index fe208e1d9d4d..82d8122c4433 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -7,7 +7,7 @@ "dependencies": { "@auth0/nextjs-auth0": "^3.5.0", "@dust-tt/client": "file:../sdks/js", - "@dust-tt/sparkle": "0.2.346", + "@dust-tt/sparkle": "^0.2.347", "@dust-tt/types": "file:../types", "@headlessui/react": "^1.7.7", "@heroicons/react": "^2.0.11", @@ -11453,9 +11453,9 @@ "link": true }, "node_modules/@dust-tt/sparkle": { - "version": "0.2.346", - "resolved": "https://registry.npmjs.org/@dust-tt/sparkle/-/sparkle-0.2.346.tgz", - "integrity": "sha512-wNOGHTcf/usi9mZMvIeMGxvvIydAh9YUhz9Sdp99KV68953wCyzSuIp5LVlHeYf8IoISJxqS9Hp3RCIgv0rLxg==", + "version": "0.2.347", + "resolved": "https://registry.npmjs.org/@dust-tt/sparkle/-/sparkle-0.2.347.tgz", + "integrity": "sha512-hSZVIjyfoyWdyDRaN32rlbbljH+cMnh1KLCknlYjGPZVTMuPrIR8QLTZO1Kg1H8RiZee79kjFxSHTRPfgRJcLA==", "dependencies": { "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", diff --git a/front/package.json b/front/package.json index 061926a49b0e..21c28fb08263 100644 --- a/front/package.json +++ b/front/package.json @@ -20,7 +20,7 @@ "dependencies": { "@auth0/nextjs-auth0": "^3.5.0", "@dust-tt/client": "file:../sdks/js", - "@dust-tt/sparkle": "0.2.346", + "@dust-tt/sparkle": "^0.2.347", "@dust-tt/types": "file:../types", "@headlessui/react": "^1.7.7", "@heroicons/react": "^2.0.11",