@contentstack/studio-registry 1.2.0 → 1.2.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.
package/dist/cjs/index.cjs
CHANGED
|
@@ -5459,6 +5459,27 @@ function retrievePropValue(args) {
|
|
|
5459
5459
|
}
|
|
5460
5460
|
else if (dataPath) {
|
|
5461
5461
|
resolvedData = get(data, dataPath, fallbackValue);
|
|
5462
|
+
// Handle primitive values in repeater context
|
|
5463
|
+
// When the array contains primitives (strings, numbers, etc.) instead of objects,
|
|
5464
|
+
// the binding path will be like: dataSources.repeater.{uid}.context.{fieldName}
|
|
5465
|
+
// But context IS the primitive value, so accessing context.fieldName returns undefined.
|
|
5466
|
+
// In this case, we should return the context itself.
|
|
5467
|
+
if (dataPath.includes("dataSources.repeater")) {
|
|
5468
|
+
const pathParts = dataPath.split(".");
|
|
5469
|
+
// Check if path is: dataSources.repeater.{uid}.context.{fieldName}
|
|
5470
|
+
if (pathParts.length >= 5 && pathParts[3] === "context") {
|
|
5471
|
+
// Try to get just the context (without the field name)
|
|
5472
|
+
const contextPath = pathParts.slice(0, 4).join("."); // dataSources.repeater.{uid}.context
|
|
5473
|
+
const contextValue = get(data, contextPath);
|
|
5474
|
+
// If context exists and is a primitive (not an object/array), return it
|
|
5475
|
+
if (contextValue !== undefined && contextValue !== null) {
|
|
5476
|
+
const isPrimitive = typeof contextValue !== "object" || contextValue === null;
|
|
5477
|
+
if (isPrimitive) {
|
|
5478
|
+
resolvedData = contextValue;
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5462
5483
|
if (type === "choice") {
|
|
5463
5484
|
if (!prop.multiSelect) {
|
|
5464
5485
|
// we are explicitly checking for single select choice type to ensure we don't have a mismatch in the data type.
|