Commit a73ab6c
committed
estuary-cdk: prevent state mutations by deep copying
Previously when initializing the state of a binding, the CDK was
directly referencing the `initial_state` of the binding and any
modifications made to the binding's `state` would also be reflected in
the `initial_state`. While this works when all bindings have their own
distinct `initial_state`s, this would cause unintended mutations if the
same `initial_state` was used for multiple bindings.
Instead, the CDK now creates a deep copy of the `initial_state` when
initializing a binding's `state`. This prevents mutations to `state`
from affecting `initial_state`.initial_state`1 parent f4fb7e4 commit a73ab6c
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | | - | |
| 576 | + | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
| 579 | + | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
| 583 | + | |
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
| |||
0 commit comments