Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: set format after error

AykutSaracb874fbef30c5
diff --git a/src/store/useFile.ts b/src/store/useFile.ts
index 4395ff02..682c552c 100644
--- a/src/store/useFile.ts
+++ b/src/store/useFile.ts
@@ -100,11 +100,12 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
try {
const contentJson = await contentToJson(get().contents, get().format);
const jsonContent = await jsonToContent(JSON.stringify(contentJson, null, 2), format);
- set({ format });
get().setContents({ contents: jsonContent, hasChanges: false });
} catch (error) {
get().clear();
console.info("The content was unable to be converted, so it was cleared instead.");
+ } finally {
+ set({ format });
}
},
setContents: async ({ contents, hasChanges = true, skipUpdate = false }) => {