Skip to content

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

refactor: move pathKey function to useGraph.ts for better organization

AykutSaracbe461870f2a1
diff --git a/apps/www/src/features/editor/views/GraphView/stores/useGraph.ts b/apps/www/src/features/editor/views/GraphView/stores/useGraph.ts
index 2d467a8c..884fb29f 100644
--- a/apps/www/src/features/editor/views/GraphView/stores/useGraph.ts
+++ b/apps/www/src/features/editor/views/GraphView/stores/useGraph.ts
@@ -1,10 +1,11 @@
import type { RefObject } from "react";
import type { JSONPath } from "jsonc-parser";
-import { pathKey } from "jsoncrack-react";
import type { LayoutDirection, NodeData, JSONCrackRef } from "jsoncrack-react";
import type { ViewPort } from "react-zoomable-ui";
import { create } from "zustand";
+const pathKey = (path: JSONPath): string => JSON.stringify(path);
+
export interface Graph {
viewPort: ViewPort | null;
jsonCrackRef: RefObject<JSONCrackRef | null> | null;
diff --git a/packages/jsoncrack-react/src/index.ts b/packages/jsoncrack-react/src/index.ts
index 0d2fccae..d2824ea1 100644
--- a/packages/jsoncrack-react/src/index.ts
+++ b/packages/jsoncrack-react/src/index.ts
@@ -1,6 +1,5 @@
export { JSONCrack } from "./JSONCrackComponent";
export { parseGraph } from "./parser";
-export { pathKey } from "./components/CollapseContext";
export type { JSONCrackProps, JSONCrackRef } from "./JSONCrackComponent";
export type { ParseGraphResult } from "./parser";
export type {