Skip to content

Commit e3edd32

Browse files
Added sanitization->temporary fields on reference.
1 parent 1ba33e9 commit e3edd32

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/transform.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,15 @@ export const transform = async (
167167
"color:red"
168168
);
169169
}
170-
if (!_isTemporaryField(field) || pathTrace.length > 0) transformedOutput[field] = result;
170+
/**
171+
* When temporary fields are referenced elsewhere,
172+
* it is essential to remove these temporary variables
173+
* to maintain a clean and accurate state.
174+
*
175+
* This ensures that temporary fields do not persist unnecessarily
176+
* or interfere with the final output.
177+
*/
178+
if (!_isTemporaryField(field) || pathTrace.length > 0) transformedOutput[field] = typeof result === "object" && !Array.isArray(result) ? _cleanTemporaryFields(result) : result;
171179
/**
172180
* When working inside a sub-transformation, there is no need to explicitly
173181
* update the derived state of the parent with changes made within the

0 commit comments

Comments
 (0)