Commit 38e43d7
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 e02fb06 commit 38e43d7
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
| 632 | + | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
| 639 | + | |
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
| |||
0 commit comments