Skip to content

Commit

Permalink
Add observable(() => ...) into reactivity whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
voliva committed Mar 25, 2023
1 parent 584f2b5 commit 079081a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rules/reactivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ export default createRule({
"untrack",
"mapArray",
"indexArray",
"observable",
],
callee.name
) ||
Expand Down
5 changes: 5 additions & 0 deletions test/rules/reactivity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ export const cases = run("reactivity", rule, {
const staticValue = () => props.value;
const value = staticValue();
}`,
// observable
`function Component(props) {
const count$ = observable(() => props.count);
return <div />;
}`,
],
invalid: [
// Untracked signals
Expand Down

0 comments on commit 079081a

Please sign in to comment.