Skip to content

Commit

Permalink
Remove unnecessary json parse, pass data as string
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Oct 30, 2024
1 parent 79e1111 commit 5df89a5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion gui/src/app/FileEditor/TextEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Editor, loader, useMonaco } from "@monaco-editor/react";
import { useTheme } from "@mui/material/styles";

Expand Down
3 changes: 1 addition & 2 deletions gui/src/app/RunPanel/RunPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { FunctionComponent, useCallback, useContext, useMemo } from "react";

import Button from "@mui/material/Button";
Expand All @@ -14,7 +13,7 @@ import Tooltip from "@mui/material/Tooltip";
type RunPanelProps = {
sampler?: StanSampler;
latestRun: StanRun;
data: any | undefined;
data: string;
dataIsSaved: boolean;
samplingOpts: SamplingOpts;
};
Expand Down
1 change: 0 additions & 1 deletion gui/src/app/components/TabWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import Box from "@mui/material/Box";
import Tab from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
Expand Down
11 changes: 2 additions & 9 deletions gui/src/app/pages/HomePage/SamplingWindow/SamplingWindow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FunctionComponent, useCallback, useContext, useMemo } from "react";
import { FunctionComponent, useCallback, useContext } from "react";

import Box from "@mui/material/Box";
import Divider from "@mui/material/Divider";
Expand All @@ -23,13 +23,6 @@ type SamplingWindowProps = {

const SamplingWindow: FunctionComponent<SamplingWindowProps> = () => {
const { data, update } = useContext(ProjectContext);
const parsedData = useMemo(() => {
try {
return JSON.parse(data.dataFileContent);
} catch (e) {
return "";
}
}, [data.dataFileContent]);

const setSamplingOpts = useCallback(
(opts: SamplingOpts) => {
Expand All @@ -55,7 +48,7 @@ const SamplingWindow: FunctionComponent<SamplingWindowProps> = () => {
<RunPanel
sampler={sampler}
latestRun={latestRun}
data={parsedData}
data={data.dataFileContent}
dataIsSaved={!modelHasUnsavedDataFileChanges(data)}
samplingOpts={data.samplingOpts}
/>
Expand Down
1 change: 0 additions & 1 deletion gui/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as ReactDOM from "react-dom/client";

import App from "./app/App";
Expand Down

0 comments on commit 5df89a5

Please sign in to comment.