nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.48k stars 1.4k forks source link

[BUG] - When using tabs as Link they are causing full page reload in NextJS #3786

Open siinghd opened 2 hours ago

siinghd commented 2 hours ago

NextUI Version

@nextui-org/tabs@^2.0.37

Describe the bug

When Using Tabs as Link they are causing full reload of the page in Nextjs

Current setup:

 const router = useRouter();
  const queryClient = getQueryClient();

  return (
    <NextUIProvider navigate={router.push}>
      <NextThemesProvider {...themeProps}>
        <QueryClientProvider client={queryClient}>
          {children}
        </QueryClientProvider>
      </NextThemesProvider>
    </NextUIProvider>
  );
const MainOrganizationSettings = () => {
  const pathname = usePathname();

  return (
    <Tabs
      aria-label="Options"
      radius="md"
      className="gap-5"
      classNames={{
        tabList: 'gap-1 w-full relative rounded-xl  border-2 border-white  p-1',
        cursor: 'w-full bg-white rounded-lg',
        tabContent: 'group-data-[selected=true]:text-primary',
        panel: 'p-0 mt-5',
      }}
      selectedKey={pathname}
    >
      <Tab
        key="/dashboard/organization/main"
        title="Organization"
        href="/dashboard/organization/main"
      >
        <MainSettings />
      </Tab>
      <Tab
        key="/dashboard/organization/team"
        title="Team"
        href="/dashboard/organization/team"
      >
        <OrganizationTeam />
      </Tab>
      <Tab
        key="/dashboard/organization/challenges"
        title="Challenges"
        href="/dashboard/organization/challenges"
      >
        <OrganizationChallenges />
      </Tab>
    </Tabs>
  );

If used Nextjs as Link, it does work but there are no animations present:

      <Tab
        as={Link} 
        key="/dashboard/organization/challenges"
        title="Challenges"
        href="/dashboard/organization/challenges"
      >
        <OrganizationChallenges />
      </Tab>

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Use tabs in your Nextjs project

Expected behavior

Page should not reload and animations should work

Screenshots or Videos

No response

Operating System Version

MacOS

Browser

Chrome

linear[bot] commented 2 hours ago

ENG-1378 [BUG] - When using tabs as Link they are causing full page reload

wingkwong commented 27 minutes ago

Client routing issue is reported lately. suspect it's due to RA side. will revisit after RA version upgrade,