Skip to content

Commit

Permalink
fix engine bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed Feb 4, 2024
1 parent bb6960c commit 00c6957
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/components/common/GoModeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ function GoModeInput({
setGoMode: (v: GoMode) => void;
}) {
return (
<Group grow>
<Group>
<SegmentedControl
maw="50%"
data={["Time", "Depth", "Nodes", "Infinite"]}
value={goMode?.t || "Infinite"}
onChange={(v) => {
Expand Down
10 changes: 6 additions & 4 deletions src/components/engines/EnginesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export default function EnginesPage() {
setParams(params);
};

const selectedEngine = selected !== null ? engines[selected] : null;
const selectedEngine =
typeof selected === "number" ? engines[selected] || null : null;

return (
<Stack h="100%" px="lg" pb="lg">
Expand Down Expand Up @@ -488,15 +489,16 @@ function EngineSettings({
}

function EngineName({ engine }: { engine: Engine }) {
const { data: fileExists } = useSWRImmutable(
const { data: fileExists, isLoading } = useSWRImmutable(
["file-exists", engine.type === "local" ? engine.path : null],
async ([, path]) => {
if (path === null) return false;
if (engine.type !== "local") return true;
return await exists(path!);
return await exists(path);
},
);

const hasError = engine.type === "local" && !fileExists;
const hasError = engine.type === "local" && !isLoading && !fileExists;

return (
<Group wrap="nowrap">
Expand Down

0 comments on commit 00c6957

Please sign in to comment.