Skip to content

Commit 733091f

Browse files
committed
enhance(vue): renderDataCompose().result is always just the direct return value
1 parent 4c9465b commit 733091f

File tree

7 files changed

+202
-186
lines changed

7 files changed

+202
-186
lines changed

.changeset/chilly-towns-run.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
'@data-client/vue': minor
3+
---
4+
5+
Never wrap renderDataCompose().result in ref. Just passthrough the return value directly. Always.
6+
7+
### Before
8+
```ts
9+
const { result, cleanup } = await renderDataCompose(() =>
10+
useSuspense(CoolerArticleResource.get, { id: payload.id }),
11+
);
12+
13+
const articleRef = await result.value;
14+
expect(articleRef.value.title).toBe(payload.title);
15+
expect(articleRef.value.content).toBe(payload.content);
16+
```
17+
18+
### After
19+
```ts
20+
const { result, cleanup } = await renderDataCompose(() =>
21+
useSuspense(CoolerArticleResource.get, { id: payload.id }),
22+
);
23+
24+
const articleRef = await result;
25+
expect(articleRef.value.title).toBe(payload.title);
26+
expect(articleRef.value.content).toBe(payload.content);
27+
```

packages/vue/src/__tests__/integration-garbage-collection.web.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('Integration Garbage Collection Web (Vue)', () => {
6464

6565
await waitForNextUpdate();
6666

67-
const articleRef = await result.value;
67+
const articleRef = await result;
6868
expect(articleRef?.value.title).toBe(articleData.title);
6969
expect(articleRef?.value.content).toBe(articleData.content);
7070

0 commit comments

Comments
 (0)