Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document scroll: false option #51602

Closed
wants to merge 10 commits into from
7 changes: 5 additions & 2 deletions packages/next/src/client/components/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import type {
CacheNode,
AppRouterInstance,
NavigateOptions,
} from '../../shared/lib/app-router-context'
import type {
FlightRouterState,
Expand Down Expand Up @@ -303,7 +304,8 @@ function Router({
})
})
},
replace: (href, options = {}) => {
// options is internal, hidden from TS users
replace: (href, options: NavigateOptions = {}) => {
startTransition(() => {
navigate(
href,
Expand All @@ -313,7 +315,8 @@ function Router({
)
})
},
push: (href, options = {}) => {

push: (href, options: NavigateOptions = {}) => {
startTransition(() => {
navigate(
href,
Expand Down
5 changes: 5 additions & 0 deletions packages/next/src/shared/lib/app-router-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export type CacheNode =
export interface NavigateOptions {
/** @internal */
forceOptimisticNavigation?: boolean
/** @internal */
scroll?: boolean
}

Expand All @@ -94,11 +95,15 @@ export interface AppRouterInstance {
* Navigate to the provided href.
* Pushes a new history entry.
*/
push(href: string): void
/** @internal */
push(href: string, options?: NavigateOptions): void
/**
* Navigate to the provided href.
* Replaces the current history entry.
*/
replace(href: string): void
/** @internal */
replace(href: string, options?: NavigateOptions): void
/**
* Prefetch the provided href.
Expand Down