Skip to content

Commit

Permalink
Fix preserveScroll and preserveState types (#1882)
Browse files Browse the repository at this point in the history
* Fix `preserveScroll` and `preserveState` types

* Update changelog
  • Loading branch information
reinink committed May 28, 2024
1 parent e270d69 commit 683155c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ For changes prior to v1.0.0, see the [legacy releases](https://legacy.inertiajs.

## [Unreleased](https://github.com/inertiajs/inertia/compare/v1.1.0...HEAD)

- Fix `preserveScroll` and `preserveState` types ([#1882](https://github.com/inertiajs/inertia/pull/1882))
- Add Svelte TypeScript support ([#1866](https://github.com/inertiajs/inertia/pull/1866))

## [v1.1.0](https://github.com/inertiajs/inertia/compare/v1.0.16...v1.1.0)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class Router {
}
}

protected resolvePreserveOption(value: PreserveStateOption, page: Page): boolean | string {
protected resolvePreserveOption(value: PreserveStateOption, page: Page): boolean {
if (typeof value === 'function') {
return value(page)
} else if (value === 'errors') {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type PageHandler = ({
preserveState: PreserveStateOption
}) => Promise<unknown>

export type PreserveStateOption = boolean | string | ((page: Page) => boolean)
export type PreserveStateOption = boolean | 'errors' | ((page: Page) => boolean)

export type Progress = AxiosProgressEvent

Expand Down

0 comments on commit 683155c

Please sign in to comment.