druxt-entity 0.29.1 → 0.29.2-dev.20261120230059

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.
@@ -362,6 +362,10 @@ export default {
362
362
  }
363
363
 
364
364
  if (this.uuid && !this.value) {
365
+ // A value the parent sets while the request is pending wins over the
366
+ // response.
367
+ const value = this.value
368
+
365
369
  // Check if we need to bypass cache.
366
370
  let bypassCache = false
367
371
  if (typeof (settings.query || {}).bypassCache === 'boolean') {
@@ -379,6 +383,8 @@ export default {
379
383
  query,
380
384
  bypassCache
381
385
  })
386
+ if (this.value !== value) return
387
+
382
388
  const entity = { ...(resource.data || {}) }
383
389
  entity.included = resource.included
384
390
  this.model = JSON.parse(JSON.stringify(entity || {}))
@@ -2,10 +2,6 @@
2
2
 
3
3
  import DruxtModule from 'druxt/dist/components/DruxtModule.vue'
4
4
 
5
- // Extract the DruxtModule model watch.
6
- const modelWatch = DruxtModule.watch.model
7
- delete DruxtModule.watch.model
8
-
9
5
  /**
10
6
  * Renders a Drupal field using a component chosen by the field type and
11
7
  * formatter settings.
@@ -81,13 +77,22 @@ export default {
81
77
  * @model
82
78
  */
83
79
  value: {
84
- type: [Array, Boolean, Number, String, Object],
80
+ // String before Boolean, or Vue reads an empty string as `true`.
81
+ type: [Array, String, Boolean, Number, Object],
85
82
  default: undefined,
86
83
  },
87
84
  },
88
85
 
89
86
  fetchKey(getCounter) {
90
- const parent = (this.$parent || {}).entity || ((this.$parent || {}).$parent || {}).entity || {}
87
+ // The closest component above that holds an entity. A field rendered in
88
+ // another component's slot is a child of that component, not its entity.
89
+ let parent = {}
90
+ for (let vm = this.$parent; vm; vm = vm.$parent) {
91
+ if (vm.entity) {
92
+ parent = vm.entity
93
+ break
94
+ }
95
+ }
91
96
  const parts = ['DruxtField', parent.type, parent.id, this.schema.id].filter((o) => o)
92
97
  return [...parts, getCounter(parts.join(':'))].join(':')
93
98
  },
@@ -180,14 +185,6 @@ export default {
180
185
  this.component.props.errors = this.errors
181
186
  this.component.propsData.errors = this.errors
182
187
  },
183
-
184
- model() {
185
- // Sanitize empty string based fields.
186
- if (this.model === '') { this.model = undefined }
187
-
188
- // Invoke the DruxtModule model watch callback.
189
- modelWatch.call(this)
190
- },
191
188
  },
192
189
 
193
190
  /** DruxtModule settings */
@@ -239,7 +239,7 @@ const DruxtFieldMixin = {
239
239
  required: true
240
240
  },
241
241
  value: {
242
- type: [Array, Boolean, Number, String, Object],
242
+ type: [Array, String, Boolean, Number, Object],
243
243
  default: void 0
244
244
  },
245
245
  wrapper: {
@@ -243,7 +243,7 @@ const DruxtFieldMixin = {
243
243
  required: true
244
244
  },
245
245
  value: {
246
- type: [Array, Boolean, Number, String, Object],
246
+ type: [Array, String, Boolean, Number, Object],
247
247
  default: void 0
248
248
  },
249
249
  wrapper: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-entity",
3
- "version": "0.29.1",
3
+ "version": "0.29.2-dev.20261120230059",
4
4
  "description": "Drupal Display Mode powered Entity, Form and Field Druxt components.",
5
5
  "keywords": [
6
6
  "cms",
@@ -51,9 +51,9 @@
51
51
  "dependencies": {
52
52
  "deepmerge": "^4.3.1",
53
53
  "drupal-jsonapi-params": "^2.3.2",
54
- "druxt": "^0.25.1",
55
- "druxt-router": "^0.32.1",
56
- "druxt-schema": "^0.12.1"
54
+ "druxt": "0.25.2-dev.20261120230059",
55
+ "druxt-router": "0.32.2-dev.20261120230059",
56
+ "druxt-schema": "0.12.2-dev.20261120230059"
57
57
  },
58
58
  "devDependencies": {
59
59
  "druxt-test-utils": "^0.2.16",