@microsoft/fast-html 1.0.0-alpha.43 → 1.0.0-alpha.44
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.
|
@@ -789,7 +789,29 @@ function assignObservablesToArray(proxiedData, schema, rootSchema, target, rootP
|
|
|
789
789
|
});
|
|
790
790
|
},
|
|
791
791
|
});
|
|
792
|
-
|
|
792
|
+
if (schemaProperties !== null) {
|
|
793
|
+
return data;
|
|
794
|
+
}
|
|
795
|
+
// For primitive arrays, wrap in a Proxy so that direct index assignment
|
|
796
|
+
// (e.g. arr[0] = value) triggers FAST's splice-based change tracking and
|
|
797
|
+
// keeps repeat directives in sync. Object arrays are not wrapped because
|
|
798
|
+
// their items are individually proxied, and FAST's own push/splice/etc.
|
|
799
|
+
// already carry splice records — double-wrapping would produce duplicate
|
|
800
|
+
// splice notifications.
|
|
801
|
+
return new Proxy(data, {
|
|
802
|
+
set: (arr, prop, value) => {
|
|
803
|
+
const idx = typeof prop === "string" ? Number(prop) : NaN;
|
|
804
|
+
if (typeof prop !== "symbol" && Number.isInteger(idx) && idx >= 0) {
|
|
805
|
+
// splice() replaces the item in-place and creates the splice
|
|
806
|
+
// record that FAST's ArrayObserver delivers to repeat directives.
|
|
807
|
+
Array.prototype.splice.call(arr, idx, 1, value);
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
arr[prop] = value;
|
|
811
|
+
}
|
|
812
|
+
return true;
|
|
813
|
+
},
|
|
814
|
+
});
|
|
793
815
|
}
|
|
794
816
|
/**
|
|
795
817
|
* Extracts the definition name from a JSON Schema $ref property
|
|
@@ -866,6 +888,12 @@ export function assignObservables(schema, rootSchema, data, target, rootProperty
|
|
|
866
888
|
}));
|
|
867
889
|
}
|
|
868
890
|
}
|
|
891
|
+
else {
|
|
892
|
+
// Primitive array (items have no schema $ref): wrap in a proxy so that
|
|
893
|
+
// direct index assignments (e.g. arr[0] = value) use FAST's splice-based
|
|
894
|
+
// change tracking and keep repeat directives in sync.
|
|
895
|
+
proxiedData = assignObservablesToArray(proxiedData, schema, rootSchema, target, rootProperty);
|
|
896
|
+
}
|
|
869
897
|
break;
|
|
870
898
|
}
|
|
871
899
|
case "object": {
|