Skip to content

Commit e257e3b

Browse files
authoredDec 3, 2022
chore(client)!: remove never implemented hot.decline (#11036)
1 parent 859fe05 commit e257e3b

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed
 

‎docs/guide/api-hmr.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ interface ViteHotContext {
3030

3131
dispose(cb: (data: any) => void): void
3232
prune(cb: (data: any) => void): void
33-
decline(): void
3433
invalidate(message?: string): void
3534

3635
// `InferCustomEventPayload` provides types for built-in Vite events
@@ -139,7 +138,7 @@ The `import.meta.hot.data` object is persisted across different instances of the
139138
140139
## `hot.decline()`
141140
142-
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.
141+
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()`.
143142
144143
## `hot.invalidate(message?: string)`
145144

‎packages/vite/src/client/client.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ export function createHotContext(ownerPath: string): ViteHotContext {
550550
pruneMap.set(ownerPath, cb)
551551
},
552552

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

‎packages/vite/types/hot.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export interface ViteHotContext {
2222

2323
dispose(cb: (data: any) => void): void
2424
prune(cb: (data: any) => void): void
25-
decline(): void
2625
invalidate(message?: string): void
2726

2827
on<T extends string>(

0 commit comments

Comments
 (0)