Closed ScotterC closed 1 year ago
Defaults are processed when the file is loaded. If you want it to be initialized each time put it in a lambda.
array :responses, default: -> { [] }
🤦:) Glad there’s already docs in place! I’ll go try reading them.
This is surprising behavior to me but maybe my mental model is off. When setting a default value for an array, such as an empty array, it maintains state of that array between separate calls to the interaction. In the below example, I would expect each run to have a
responses
length of 1 since it is adding to an empty array each time.In a different scenario, with an array with default values, I'd expect those values to be initialized each time the interaction is run as well.