@kitware/vtk.js 21.3.0 → 21.3.1

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.
Files changed (2) hide show
  1. package/macros.js +6 -2
  2. package/package.json +1 -1
package/macros.js CHANGED
@@ -553,12 +553,15 @@ function setArray(publicAPI, model, fieldNames, size) {
553
553
  }
554
554
 
555
555
  var array = args;
556
- var changeDetected; // allow null or an array to be passed as a single arg.
556
+ var changeDetected;
557
+ var needCopy = false; // allow null or an array to be passed as a single arg.
557
558
 
558
559
  if (array.length === 1 && (array[0] == null || array[0].length >= 0)) {
559
560
  /* eslint-disable prefer-destructuring */
560
561
  array = array[0];
561
562
  /* eslint-enable prefer-destructuring */
563
+
564
+ needCopy = true;
562
565
  }
563
566
 
564
567
  if (array == null) {
@@ -567,6 +570,7 @@ function setArray(publicAPI, model, fieldNames, size) {
567
570
  if (size && array.length !== size) {
568
571
  if (array.length < size && defaultVal !== undefined) {
569
572
  array = Array.from(array);
573
+ needCopy = false;
570
574
 
571
575
  while (array.length < size) {
572
576
  array.push(defaultVal);
@@ -580,7 +584,7 @@ function setArray(publicAPI, model, fieldNames, size) {
580
584
  return item !== array[index];
581
585
  }) || model[field].length !== array.length;
582
586
 
583
- if (changeDetected && !Array.isArray(array)) {
587
+ if (changeDetected && needCopy) {
584
588
  array = Array.from(array);
585
589
  }
586
590
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "21.3.0",
3
+ "version": "21.3.1",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",