Next.js Discord

Discord Forum

Navigating to a page causes scroll to server component

Unanswered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Australian Freshwater CrocodileOP
I have a page with a server component. For some reason when navigating to this page, from another page the page instant scrolls into a table Server component. Replacing the server component with a client component does not cause this issue.

Link setup:

        <Stack direction="row" flex={1}>
          <Link href="/" sx={{ "& svg": { color: "common.white" } }}>
            <LogoLong sx={{ display: DESKTOP_ONLY, width: 132, height: 40 }} />
            <LogoShort sx={{ display: MOBILE_ONLY, width: 40, height: 40 }} />
          </Link>
        </Stack>


Causes issue:

        <Stack className="overflow">
          {leaderboardTable}
        </Stack>


Does not cause issue:

        <Stack className="overflow">
          <LeaderboardTable />
        </Stack>


Both render the same table component.

Demo:
https://www.loom.com/share/ee0bd363754245338250f801693ca911

1 Reply

Australian Freshwater CrocodileOP
(The error is unrelated, it's a heads up that the user is not authenticated)