@pinia/root / pinia / acceptHMRUpdate
acceptHMRUpdate()
ts
function acceptHMRUpdate<Id, S, G, A>(initialUseStore, hot): (newModule) => any;Creates an accept function to pass to import.meta.hot in Vite applications.
Type Parameters
Id
Id extends string = string
S
S extends StateTree = StateTree
G
G extends _GettersTree<S> = _GettersTree<S>
A
A = _ActionsTree
Parameters
initialUseStore
StoreDefinition<Id, S, G, A>
return of the defineStore to hot update
hot
any
import.meta.hot
Returns
ts
(newModule): any;Parameters
newModule
any
Returns
any
Example
js
const useUser = defineStore(...)
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))
}
