How to drive a "dirty" flag i.e. for all edits, set some global isDirty=true? #2314
Unanswered
res63661
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have the need in literally every store that we create to be able to bind the ux to some value that turns true as soon as the state is mutated in some way. This includes nested complex objects. It is not Clear to me what the best practice should be for this I've tried several different things including subscriptions but with the limited success. How to do this In a lean efficient manner without overloading the system computationally?
ex:
Given some store:
{
...
state = ()=>({
person: { name: "Fred", id: "lkjh-1234-2-432-1234432"},
isDirty: false,
...
})
...
}
Assume we make some edit as follows:
store.person.name = "Wong"
//store.isDirty now == true
We now need our save buttons to enable across our application. So we want to bind to store.isDirty
How to achieve this?
Love Pinia - thx so much for building this!
very best, R
Beta Was this translation helpful? Give feedback.
All reactions