Skip to content

Commit 3f0cfa0

Browse files
committed
eslint-disable-next-lineしなくてもuseImperativeHandleでよいのでは?
1 parent c6f6ed0 commit 3f0cfa0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/runtime/tests/vitest-all.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, beforeAll, afterAll, it, beforeEach } from "vitest";
33
import { RuntimeProvider, useRuntimeAll } from "../src/context";
44
import { RuntimeLang } from "../src/languages";
55
import { RuntimeContext } from "../src/interface";
6-
import { RefObject } from "react";
6+
import { RefObject, useImperativeHandle } from "react";
77

88
import { RUNTIME_TIMEOUTS, waitForRuntimeReady } from "./utils";
99
import { replTests } from "./repl";
@@ -15,8 +15,7 @@ const RuntimeLoader = ({
1515
runtimeRef: RefObject<Record<RuntimeLang, RuntimeContext> | null>;
1616
}) => {
1717
const runtimeAll = useRuntimeAll();
18-
// eslint-disable-next-line react-hooks/refs
19-
runtimeRef.current = runtimeAll;
18+
useImperativeHandle(runtimeRef, () => runtimeAll, [runtimeAll]);
2019
return null;
2120
};
2221

0 commit comments

Comments
 (0)