From 06e293134709607ab281fd32fdff981cf7418c49 Mon Sep 17 00:00:00 2001 From: Prev Wong Date: Fri, 27 Oct 2023 15:41:36 +0200 Subject: [PATCH] fix: member expr assignment op (#98) --- .changeset/fair-buttons-sell.md | 5 +++++ packages/core/src/expression.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fair-buttons-sell.md diff --git a/.changeset/fair-buttons-sell.md b/.changeset/fair-buttons-sell.md new file mode 100644 index 0000000..aee1817 --- /dev/null +++ b/.changeset/fair-buttons-sell.md @@ -0,0 +1,5 @@ +--- +'@rekajs/core': patch +--- + +Fix assignment op on member expressions diff --git a/packages/core/src/expression.ts b/packages/core/src/expression.ts index 6eef3f1..b004d37 100644 --- a/packages/core/src/expression.ts +++ b/packages/core/src/expression.ts @@ -64,7 +64,7 @@ const updateLocalValue = ( let targetValue = baseValue; for (let i = 1; i < path.length - 1; i++) { - targetValue = baseValue[path[i]]; + targetValue = targetValue[path[i]]; } targetValue[path[path.length - 1]] = newValue;