Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Refs are not passed correctly to directive callbacks #191

Closed
DAreRodz opened this issue Mar 23, 2023 · 0 comments · Fixed by #224
Closed

Refs are not passed correctly to directive callbacks #191

DAreRodz opened this issue Mar 23, 2023 · 0 comments · Fixed by #224
Labels
bug Something isn't working

Comments

@DAreRodz
Copy link
Collaborator

While experimenting with Luis, we noticed that the ref attribute the evaluate function injects to directive callbacks could be incorrectly passed.

It happens when ref.current is null.

In that case, a null reference is passed here to the getEvaluate function.

const evaluate = getEvaluate({ ref: ref.current });

That function then passes down the null reference to the value function.

return typeof value === 'function'
? value({
state: store.state,
...(ref !== undefined ? { ref } : {}),
...extraArgs,
})
: value;

We should pass the ref object to getEvaluate instead of ref.current, and pass ref.current to value as argument.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant