Skip to content

Commit a4a4135

Browse files
authored
Merge pull request #90 from voliva/observable-reactivity
Add `observable(() => ...)` into reactivity whitelist
2 parents 584f2b5 + 079081a commit a4a4135

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/rules/reactivity.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ export default createRule({
895895
"untrack",
896896
"mapArray",
897897
"indexArray",
898+
"observable",
898899
],
899900
callee.name
900901
) ||

test/rules/reactivity.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ export const cases = run("reactivity", rule, {
293293
const staticValue = () => props.value;
294294
const value = staticValue();
295295
}`,
296+
// observable
297+
`function Component(props) {
298+
const count$ = observable(() => props.count);
299+
return <div />;
300+
}`,
296301
],
297302
invalid: [
298303
// Untracked signals

0 commit comments

Comments
 (0)