apostrophe 4.3.2 → 4.3.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.3.3 (2024-06-04)
4
+
5
+ * Removes `$nextTick` use to re render schema in `AposArrayEditor` because it was triggering weird vue error in production.
6
+ Instead, makes the AposSchema for loop keys more unique using `modelValue.data._id`,
7
+ if document changes it re-renders schema fields.
8
+
3
9
  ## 4.3.2 (2024-05-18)
4
10
 
5
11
  ### Fixes
@@ -32,7 +32,7 @@
32
32
  <component
33
33
  :is="fieldStyle === 'table' ? 'td' : 'div'"
34
34
  v-for="field in schema"
35
- :key="field.name.concat(field._id ?? '')"
35
+ :key="generateItemUniqueKey(field)"
36
36
  :data-apos-field="field.name"
37
37
  :style="(fieldStyle === 'table' && field.columnStyle) || {}"
38
38
  :class="{'apos-field--hidden': !displayComponent(field)}"
@@ -149,7 +149,7 @@ export default {
149
149
  const [ _id, name ] = first.path.split('.');
150
150
  await this.select(_id);
151
151
  const aposSchema = this.$refs.schema;
152
- await this.nextTick();
152
+ await this.$nextTick();
153
153
  aposSchema.scrollFieldIntoView(name);
154
154
  }
155
155
  this.titleFieldChoices = await this.getTitleFieldChoices();
@@ -160,11 +160,7 @@ export default {
160
160
  return;
161
161
  }
162
162
  if (await this.validate(true, false)) {
163
- // Force the array editor to totally reset to avoid in-schema
164
- // animations when switching (e.g., the relationship input).
165
163
  this.currentDocToCurrentItem();
166
- this.currentId = null;
167
- await this.nextTick();
168
164
  this.currentId = _id;
169
165
  this.currentDoc = {
170
166
  hasErrors: false,
@@ -261,7 +257,7 @@ export default {
261
257
  if (validateItem) {
262
258
  this.triggerValidation = true;
263
259
  }
264
- await this.nextTick();
260
+ await this.$nextTick();
265
261
  if (validateLength) {
266
262
  this.updateMinMax();
267
263
  }
@@ -279,14 +275,6 @@ export default {
279
275
  return true;
280
276
  }
281
277
  },
282
- // Awaitable nextTick
283
- nextTick() {
284
- return new Promise((resolve, reject) => {
285
- this.$nextTick(() => {
286
- return resolve();
287
- });
288
- });
289
- },
290
278
  newInstance() {
291
279
  const instance = {};
292
280
  for (const field of this.schema) {
@@ -181,7 +181,7 @@ export default {
181
181
  this.populateDocData();
182
182
  }
183
183
  },
184
- generation() {
184
+ generation(generated) {
185
185
  // repopulate the schema.
186
186
  this.populateDocData();
187
187
  },
@@ -331,6 +331,10 @@ export default {
331
331
  },
332
332
  highlight(fieldName) {
333
333
  return this.meta[fieldName]?.['@apostrophecms/schema:highlight'];
334
+ },
335
+ generateItemUniqueKey(field) {
336
+ return `${field.name}:${field._id ?? ''}:${this.modelValue?.data?._id ?? ''}`;
337
+
334
338
  }
335
339
  }
336
340
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apostrophe",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "description": "The Apostrophe Content Management System.",
5
5
  "main": "index.js",
6
6
  "scripts": {