Skip to content

Commit

Permalink
fix: prop binding callback cache
Browse files Browse the repository at this point in the history
  • Loading branch information
prevwong committed Dec 13, 2023
1 parent 20128a2 commit f477ae6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilly-avocados-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rekajs/core': patch
---

Fix prop binding callback function cache
9 changes: 8 additions & 1 deletion packages/core/src/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,20 @@ export const computeExpression = (
}

if (expr instanceof t.PropBinding) {
return (value: any) => {
const fn = (value: any) => {
reka.change(() => {
updateLocalValue(expr.identifier, reka, env, ctx, () => {
return value;
});
});
};

fn[
'PropBindingIdentifier'
] = `${expr.identifier.id}.${expr.identifier.name}`;
fn['FuncNodeId'] = `PropBindingCallback#${expr.identifier.id}`;

return fn;
}

if (expr instanceof t.Block) {
Expand Down

1 comment on commit f477ae6

@vercel
Copy link

@vercel vercel bot commented on f477ae6 Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

reka – ./

reka-prevwong.vercel.app
reka.js.org
rekajs.vercel.app
reka-git-main-prevwong.vercel.app

Please sign in to comment.