Skip to content

Functional key option #376

Open
Open
@EranosyanEduard

Description

@EranosyanEduard

Clear and concise description of the problem

Hello. I'd like to have functional key option. Functional Key should to compute while read/write a data to/from a storage.

Example:

import { defineStore } from 'pinia'
import getKey from './getKey.js'

export const useCounterStore = defineStore({
  id: 'counter',
  state: () => ({
    counter: 0
  }),
  persist: {
    key: () => {
      return getKey()
    }
  }
})

Thank you.

Suggested solution

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions