Skip to content

Commit e4b4bea

Browse files
committed
throw on using incorrect update/unmount function
1 parent 4c0f1f5 commit e4b4bea

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/render-async.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ function buildRenderResult(
6363
const instance = renderer.root;
6464

6565
const update = function (component: React.ReactElement) {
66-
void act(() => {
67-
renderer.update(wrap(component));
68-
});
66+
throw new Error(
67+
'`update(...)` is not supported when using `renderAsync` use `await updateAsync(...)` instead',
68+
);
6969
};
7070
const updateAsync = async function (component: React.ReactElement) {
7171
// eslint-disable-next-line require-await
@@ -75,9 +75,9 @@ function buildRenderResult(
7575
};
7676

7777
const unmount = () => {
78-
void act(() => {
79-
renderer.unmount();
80-
});
78+
throw new Error(
79+
'`unmount()` is not supported when using `renderAsync` use `await unmountAsync()` instead',
80+
);
8181
};
8282
const unmountAsync = async () => {
8383
// eslint-disable-next-line require-await

0 commit comments

Comments
 (0)