This package has been deprecated

Author message:

HMR support is now natively supported since ^3.2.0

@pinia-plugin-persistedstate/hmr
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@pinia-plugin-persistedstate/hmr

Override for Pinia's acceptHMRUpdate

🚀 Quickstart

  1. Install with your favorite package manager:

    • pnpm : pnpm i -D @pinia-plugin-persistedstate/hmr
    • npm : npm i -D @pinia-plugin-persistedstate/hmr
    • yarn : yarn add -D @pinia-plugin-persistedstate/hmr
  2. Replace acceptHMRUpdate in your store definition file with:

import { defineStore } from 'pinia'
import { acceptHMRUpdateWithHydration } from '@pinia-plugin-persistedstate/hmr'

const useStore = defineStore('store', {
  // ...
})

if (import.meta.hot)
  import.meta.hot.accept(acceptHMRUpdateWithHydration(useStore, import.meta.hot))

⚠️ Warning

This is a copy/paste of Pinia's acceptHMRUpdate function that triggers $hydrate on HMR update. Use at your own risk. :)

📝 License

Copyright © 2022 Sacha Bouillez.
This project is under MIT license.

/@pinia-plugin-persistedstate/hmr/

    Package Sidebar

    Install

    npm i @pinia-plugin-persistedstate/hmr

    Weekly Downloads

    1

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    5.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • prazdevs