Skip to content

Commit 5a02cb8

Browse files
committed
refactor
1 parent 8ecd67b commit 5a02cb8

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

src/features/editor/views/TreeView/index.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ export const TreeView = () => {
1010
const json = useJson(state => state.json);
1111

1212
return (
13-
<>
14-
<JSONTree
15-
hideRoot
16-
data={JSON.parse(json)}
17-
valueRenderer={(valueAsString, value) => <Value {...{ valueAsString, value }} />}
18-
labelRenderer={(keyPath, nodeType) => <Label {...{ keyPath, nodeType }} />}
19-
theme={{
20-
extend: {
21-
overflow: "scroll",
22-
height: "100%",
23-
scheme: "monokai",
24-
author: "wimer hazenberg (http://www.monokai.nl)",
25-
base00: theme.GRID_BG_COLOR,
26-
},
27-
}}
28-
/>
29-
</>
13+
<JSONTree
14+
hideRoot
15+
data={JSON.parse(json)}
16+
valueRenderer={(valueAsString, value) => <Value {...{ valueAsString, value }} />}
17+
labelRenderer={(keyPath, nodeType) => <Label {...{ keyPath, nodeType }} />}
18+
theme={{
19+
extend: {
20+
overflow: "scroll",
21+
height: "100%",
22+
scheme: "monokai",
23+
author: "wimer hazenberg (http://www.monokai.nl)",
24+
base00: theme.GRID_BG_COLOR,
25+
},
26+
}}
27+
/>
3028
);
3129
};

src/store/useFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
178178
}
179179
},
180180
checkEditorSession: (url, widget) => {
181-
if (url && typeof url === "string") {
182-
if (isURL(url)) return get().fetchUrl(url);
181+
if (url && typeof url === "string" && isURL(url)) {
182+
return get().fetchUrl(url);
183183
}
184184

185185
let contents = defaultJson;

0 commit comments

Comments
 (0)