Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
AykutSarac committed Jan 13, 2025
1 parent 8ecd67b commit 5a02cb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
32 changes: 15 additions & 17 deletions src/features/editor/views/TreeView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ export const TreeView = () => {
const json = useJson(state => state.json);

return (
<>
<JSONTree
hideRoot
data={JSON.parse(json)}
valueRenderer={(valueAsString, value) => <Value {...{ valueAsString, value }} />}
labelRenderer={(keyPath, nodeType) => <Label {...{ keyPath, nodeType }} />}
theme={{
extend: {
overflow: "scroll",
height: "100%",
scheme: "monokai",
author: "wimer hazenberg (http://www.monokai.nl)",
base00: theme.GRID_BG_COLOR,
},
}}
/>
</>
<JSONTree
hideRoot
data={JSON.parse(json)}
valueRenderer={(valueAsString, value) => <Value {...{ valueAsString, value }} />}
labelRenderer={(keyPath, nodeType) => <Label {...{ keyPath, nodeType }} />}
theme={{
extend: {
overflow: "scroll",
height: "100%",
scheme: "monokai",
author: "wimer hazenberg (http://www.monokai.nl)",
base00: theme.GRID_BG_COLOR,
},
}}
/>
);
};
4 changes: 2 additions & 2 deletions src/store/useFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
}
},
checkEditorSession: (url, widget) => {
if (url && typeof url === "string") {
if (isURL(url)) return get().fetchUrl(url);
if (url && typeof url === "string" && isURL(url)) {
return get().fetchUrl(url);
}

let contents = defaultJson;
Expand Down

0 comments on commit 5a02cb8

Please sign in to comment.