✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
fix: widget default data
AykutSarac6e3107dda14c
diff --git a/src/components/Graph/index.tsx b/src/components/Graph/index.tsxindex fc841f97..8ae051b8 100644--- a/src/components/Graph/index.tsx+++ b/src/components/Graph/index.tsx@@ -139,7 +139,7 @@ export const Graph = ({ isWidget = false }: GraphProps) => {maxScale={2}minScale={0.05}initialScale={0.4}- wheel={{ step: 0.08 }}+ wheel={{ step: 0.04 }}zoomAnimation={{ animationType: "linear" }}doubleClick={{ disabled: true }}onInit={onInit}diff --git a/src/pages/widget.tsx b/src/pages/widget.tsxindex 103f166e..b172954a 100644--- a/src/pages/widget.tsx+++ b/src/pages/widget.tsx@@ -28,12 +28,14 @@ const WidgetPage = () => {const [theme, setTheme] = React.useState("dark");const fetchFile = useFile(state => state.fetchFile);const setGraph = useGraph(state => state.setGraph);+ const clearGraph = useGraph(state => state.clearGraph);React.useEffect(() => {if (isReady) {if (typeof query?.json === "string") fetchFile(query.json);+ else clearGraph();}- }, [fetchFile, isReady, push, query.json, query.partner]);+ }, [clearGraph, fetchFile, isReady, push, query.json, query.partner]);React.useEffect(() => {const handler = (event: EmbedMessage) => {diff --git a/src/store/useGraph.tsx b/src/store/useGraph.tsxindex 7e12c283..110ffde0 100644--- a/src/store/useGraph.tsx+++ b/src/store/useGraph.tsx@@ -44,7 +44,7 @@ interface GraphActions {const useGraph = create<Graph & GraphActions>((set, get) => ({...initialStates,- clearGraph: () => set({ nodes: [], edges: [] }),+ clearGraph: () => set({ nodes: [], edges: [], loading: false }),setSelectedNode: nodeData => set({ selectedNode: nodeData }),setGraph: (data, options) => {const { nodes, edges } = parser(data ?? useJson.getState().json);