Closed janhalama closed 2 years ago
Current workaround is to pass the source array and index into the operation:
call foreach(index of Array(SOURCE_ARRAY.length).fill().map((_, i) => i)) OPERATION(SOURCE_ARRAY = SOURCE_ARRAY, index = index)
Related: #214
Expected Behavior
When iterating through list of items that contain Buffer variable Comlink foreach should not change Buffer variable and Buffer.isBuffer(item.buffer) should return true.
Current Behavior
Buffer variable in the first item is preserved, but all subsequent items have Buffer variable changed and Buffer.isBuffer(item.buffer) returns false.
Possible Solution
Do not merge item variables when iterating through the list.
Steps to Reproduce
Live example: https://github.com/janhalama/one-sdk-foreach-bug-demo