Skip to content

Commit

Permalink
chore(client)!: remove never implemented hot.decline (#11036)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Dec 3, 2022
1 parent 859fe05 commit e257e3b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions docs/guide/api-hmr.md
Expand Up @@ -30,7 +30,6 @@ interface ViteHotContext {

dispose(cb: (data: any) => void): void
prune(cb: (data: any) => void): void
decline(): void
invalidate(message?: string): void

// `InferCustomEventPayload` provides types for built-in Vite events
Expand Down Expand Up @@ -139,7 +138,7 @@ The `import.meta.hot.data` object is persisted across different instances of the
## `hot.decline()`
Calling `import.meta.hot.decline()` indicates this module is not hot-updatable, and the browser should perform a full reload if this module is encountered while propagating HMR updates.
This is currently a noop and is there for backward compatibility. This could change in the future if there is a new usage for it. To indicate that the module is not hot-updatable, use `hot.invalidate()`.
## `hot.invalidate(message?: string)`
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/client/client.ts
Expand Up @@ -550,7 +550,8 @@ export function createHotContext(ownerPath: string): ViteHotContext {
pruneMap.set(ownerPath, cb)
},

// TODO
// Kept for backward compatibility (#11036)
// @ts-expect-error untyped
// eslint-disable-next-line @typescript-eslint/no-empty-function
decline() {},

Expand Down
1 change: 0 additions & 1 deletion packages/vite/types/hot.d.ts
Expand Up @@ -22,7 +22,6 @@ export interface ViteHotContext {

dispose(cb: (data: any) => void): void
prune(cb: (data: any) => void): void
decline(): void
invalidate(message?: string): void

on<T extends string>(
Expand Down

0 comments on commit e257e3b

Please sign in to comment.