From 20012b6f6674ca7f8f465293392de4d81b683806 Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Tue, 31 Mar 2026 01:17:41 +0530 Subject: [PATCH 1/6] fix: search box reload --- src/components/GraphView.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index 335f400..6371663 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -356,7 +356,23 @@ const GraphView = ({ }, 300); return () => clearTimeout(timeout); - }, [searchString]); + }, [searchString, nodes]); + + const handleKeyDown = useCallback( + (e: React.KeyboardEvent) => { + if (matchCount <= 1) return; + + if (e.key === "ArrowRight" || e.key === "Enter") { + e.preventDefault(); + navigateMatch("next"); + } else if (e.key === "ArrowLeft") { + e.preventDefault(); + navigateMatch("prev"); + } + }, + [matchCount, navigateMatch] + ); + return (
Date: Tue, 31 Mar 2026 01:19:25 +0530 Subject: [PATCH 2/6] add changeset --- .changeset/every-paws-wish.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/every-paws-wish.md diff --git a/.changeset/every-paws-wish.md b/.changeset/every-paws-wish.md new file mode 100644 index 0000000..d30a40d --- /dev/null +++ b/.changeset/every-paws-wish.md @@ -0,0 +1,5 @@ +--- +"json-schema-studio": patch +--- + +Fix search results not refreshing when schema is modified while search is active From 7a4f2af74beac61a74d70c40d19253377625b39a Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Tue, 31 Mar 2026 21:09:46 +0530 Subject: [PATCH 3/6] fix: ui flickering resolution --- src/components/GraphView.tsx | 57 ++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index 6371663..cf2e6a7 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -305,12 +305,31 @@ const GraphView = ({ const trimmed = searchString.trim(); const timeout = setTimeout(() => { +<<<<<<< HEAD if (!trimmed || trimmed.length < 3) { setMatchedNodes([]); +======= + if (!trimmed) { + setMatchedNodes((prev) => (prev.length > 0 ? [] : prev)); +>>>>>>> 96819e6 (fix: ui flickering resolution) setCurrentMatchIndex(0); setErrorMessage(""); - setNodes((nds) => nds.map((n) => ({ ...n, selected: false }))); - fitView({ duration: 800, padding: 0.05 }); + + setNodes((nds) => { + let hasSelected = false; + const newNodes = nds.map((n) => { + if (n.selected) hasSelected = true; + return { ...n, selected: false }; + }); + + if (hasSelected) { + setTimeout(() => { + fitView({ duration: 800, padding: 0.05 }); + }, 0); + return newNodes; + } + return nds; + }); return; } @@ -324,26 +343,34 @@ const GraphView = ({ return searchWords.every((word) => titleKeyWords.includes(word)); }); - setMatchedNodes(foundNodes); + setMatchedNodes((prev) => { + if ( + prev.length === foundNodes.length && + prev.every((n, i) => n.id === foundNodes[i].id) + ) { + return prev; + } + return foundNodes; + }); if (foundNodes.length > 0) { - setCurrentMatchIndex(0); - const firstNode = foundNodes[0]; - const x = firstNode.position.x + NODE_WIDTH / 2; - const y = firstNode.position.y + NODE_HEIGHT / 2; - - setSelectedNode({ - id: firstNode.id, - }); - - setCenter(x, y, { zoom: Math.max(getZoom(), 1), duration: 500 }); + const targetNode = foundNodes[currentMatchIndex % foundNodes.length]; + setNodes((nds) => { let changed = false; const newNodes = nds.map((n) => { - const selected = n.id === firstNode.id; + const selected = n.id === targetNode.id; if (n.selected !== selected) changed = true; return { ...n, selected }; }); + + if (changed) { + const x = targetNode.position.x + NODE_WIDTH / 2; + const y = targetNode.position.y + NODE_HEIGHT / 2; + setTimeout(() => { + setCenter(x, y, { zoom: Math.max(getZoom(), 1), duration: 500 }); + }, 0); + } return changed ? newNodes : nds; }); @@ -356,7 +383,7 @@ const GraphView = ({ }, 300); return () => clearTimeout(timeout); - }, [searchString, nodes]); + }, [searchString, nodes, currentMatchIndex]); const handleKeyDown = useCallback( (e: React.KeyboardEvent) => { From e7a3c1f4c51cf70e9ed7d4baa3b6084444e17e80 Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Wed, 1 Apr 2026 00:23:07 +0530 Subject: [PATCH 4/6] inital load zoomed in issue --- src/components/GraphView.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index cf2e6a7..f0b5786 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -417,6 +417,8 @@ const GraphView = ({ nodeTypes={nodeTypes} minZoom={0.05} maxZoom={5} + fitView + fitViewOptions={{ padding: 0.05, duration: 800 }} onEdgeMouseEnter={(_, edge) => setHoveredEdgeId(edge.id)} onEdgeMouseLeave={() => setHoveredEdgeId(null)} onPaneClick={() => { From 9b958670a150c394b945c16b1f30eaba7bebbed2 Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Sun, 26 Apr 2026 16:31:16 +0530 Subject: [PATCH 5/6] fix: resolve merge conflict --- src/components/GraphView.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index f0b5786..c2d8aa9 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -305,13 +305,8 @@ const GraphView = ({ const trimmed = searchString.trim(); const timeout = setTimeout(() => { -<<<<<<< HEAD - if (!trimmed || trimmed.length < 3) { - setMatchedNodes([]); -======= if (!trimmed) { setMatchedNodes((prev) => (prev.length > 0 ? [] : prev)); ->>>>>>> 96819e6 (fix: ui flickering resolution) setCurrentMatchIndex(0); setErrorMessage(""); From 4c52f86d527b2f3fc32b1bd64c0b4a32006fe952 Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Sun, 26 Apr 2026 16:34:51 +0530 Subject: [PATCH 6/6] fix: restore onKeyDown handler --- src/components/GraphView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index c2d8aa9..f6c22bc 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -399,7 +399,7 @@ const GraphView = ({