Skip to content

Commit

Permalink
fix(web): fix running methods & change editor cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk committed Jan 11, 2024
1 parent dcbcd09 commit 9f627fc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import { BrowserRouter, useRoutes } from "react-router-dom";
import { ChakraProvider } from "@chakra-ui/react";
import { css, Global } from "@emotion/react";
import { loader } from "@monaco-editor/react";
import { wrapUseRoutes } from "@sentry/react";
import * as Sentry from "@sentry/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
Expand Down Expand Up @@ -69,6 +70,12 @@ function APP() {
initProviders();
}, [getSiteSettings, i18n.language, initProviders]);

useEffect(() => {
loader.config({
paths: { vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs" },
});
}, []);

return (
<Sentry.ErrorBoundary>
<QueryClientProvider client={queryClient}>
Expand Down
11 changes: 9 additions & 2 deletions web/src/pages/app/functions/mods/DebugPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ export default function DebugPanel(props: { containerRef: any }) {
];

useEffect(() => {
if (currentFunction?.methods) {
setRunningMethod(currentFunction.params?.runningMethod || currentFunction.methods[0]);
const lastRunningMethod = currentFunction.params?.runningMethod;
if (
currentFunction?.methods &&
lastRunningMethod &&
currentFunction.methods.includes(lastRunningMethod)
) {
setRunningMethod(lastRunningMethod);
} else if (currentFunction?.methods) {
setRunningMethod(currentFunction.methods[0]);
}
}, [setRunningMethod, currentFunction]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const CreateModal = (props: {
setCurrentFunction({ ...currentFunction, name: data.name });
} else if (isEdit && functionItem.name === data.name) {
res = await updateFunctionMutation.mutateAsync(data);
setCurrentFunction({ ...currentFunction, ...data });
} else {
res = await createFunctionMutation.mutateAsync(data);
}
Expand Down

0 comments on commit 9f627fc

Please sign in to comment.