frappe-ui 0.1.272 → 0.1.273

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.1.272",
3
+ "version": "0.1.273",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,4 +1,4 @@
1
- import { reactive, watch } from 'vue'
1
+ import { reactive, watch, effectScope } from 'vue'
2
2
  import { getCacheKey, createResource } from './resources'
3
3
  import {
4
4
  updateRowInListResource,
@@ -143,16 +143,20 @@ export function createDocumentResource(options, vm) {
143
143
  setDoc,
144
144
  })
145
145
 
146
- // keep track of isDirty as doc changes
147
- watch(
148
- () => out.doc,
149
- () => {
150
- out.isDirty = JSON.stringify(out.doc) !== JSON.stringify(out.originalDoc)
151
- },
152
- {
153
- deep: true,
154
- },
155
- )
146
+ // keep track of isDirty as doc changes, use effectScope to handle isDirty state reactivity for cached data
147
+ const scope = effectScope(true)
148
+ scope.run(() => {
149
+ watch(
150
+ () => out.doc,
151
+ () => {
152
+ out.isDirty =
153
+ JSON.stringify(out.doc) !== JSON.stringify(out.originalDoc)
154
+ },
155
+ {
156
+ deep: true,
157
+ },
158
+ )
159
+ })
156
160
 
157
161
  for (let methodKey in options.whitelistedMethods) {
158
162
  let methodOptions = options.whitelistedMethods[methodKey]