refactor(webui): centralize native runtime access (#4769)
This commit is contained in:
+3
-4
@@ -57,7 +57,6 @@ import {
|
||||
} from "@/lib/api";
|
||||
import {
|
||||
createRuntimeHost,
|
||||
getHostApi,
|
||||
toRuntimeSurface,
|
||||
} from "@/lib/runtime";
|
||||
import { projectNameFromPath } from "@/lib/workspace";
|
||||
@@ -939,8 +938,8 @@ export default function App() {
|
||||
};
|
||||
|
||||
const handleNativeEngineRestart = async (): Promise<string> => {
|
||||
const hostApi = getHostApi();
|
||||
if (!hostApi?.restartEngine) {
|
||||
const runtimeHost = createRuntimeHost(state.runtimeSurface);
|
||||
if (!runtimeHost.restartEngine) {
|
||||
throw new Error("native engine restart is unavailable");
|
||||
}
|
||||
rememberRestartRoute();
|
||||
@@ -950,7 +949,7 @@ export default function App() {
|
||||
// ignore storage errors
|
||||
}
|
||||
try {
|
||||
await hostApi.restartEngine();
|
||||
await runtimeHost.restartEngine();
|
||||
const refreshed = await refreshReadyClient(state.client, state.runtimeSurface);
|
||||
return refreshed.token;
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user