Skip to content

Commit d99d872

Browse files
fix: Make docs example not infinitely recurse (#16183)
1 parent 7e58885 commit d99d872

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

documentation/docs/07-misc/02-testing.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ test('Effect', () => {
129129
// effects normally run after a microtask,
130130
// use flushSync to execute all pending effects synchronously
131131
flushSync();
132-
expect(log.value).toEqual([0]);
132+
expect(log).toEqual([0]);
133133

134134
count = 1;
135135
flushSync();
136136

137-
expect(log.value).toEqual([0, 1]);
137+
expect(log).toEqual([0, 1]);
138138
});
139139

140140
cleanup();
@@ -148,17 +148,13 @@ test('Effect', () => {
148148
*/
149149
export function logger(getValue) {
150150
/** @type {any[]} */
151-
let log = $state([]);
151+
let log = [];
152152

153153
$effect(() => {
154154
log.push(getValue());
155155
});
156156

157-
return {
158-
get value() {
159-
return log;
160-
}
161-
};
157+
return log;
162158
}
163159
```
164160

0 commit comments

Comments
 (0)