From 506559172abdc0e46a25d82e0688f6c0f3ff7b1d Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Sun, 5 Apr 2026 15:26:55 +0530 Subject: [PATCH 1/2] fix: reset search counter index when search string changes --- .changeset/warm-mugs-clean.md | 5 +++++ src/components/GraphView.tsx | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/warm-mugs-clean.md diff --git a/.changeset/warm-mugs-clean.md b/.changeset/warm-mugs-clean.md new file mode 100644 index 00000000..85c9a5b2 --- /dev/null +++ b/.changeset/warm-mugs-clean.md @@ -0,0 +1,5 @@ +--- +"json-schema-studio": patch +--- + +search coutner resetting to valid index when search string changes diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index 7e970a3d..a30e4126 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -314,7 +314,10 @@ const GraphView = ({ setMatchedNodes(foundNodes); if (foundNodes.length > 0) { - const firstNode = foundNodes[currentMatchIndex % foundNodes.length]; + const nextMatchIndex = 0; + setCurrentMatchIndex(nextMatchIndex); + + const firstNode = foundNodes[nextMatchIndex]; const x = firstNode.position.x + NODE_WIDTH / 2; const y = firstNode.position.y + NODE_HEIGHT / 2; From 5818b21498a427b6abf7b5cb040cb2071caa5694 Mon Sep 17 00:00:00 2001 From: Saksham Mahajan Date: Sun, 5 Apr 2026 22:34:41 +0530 Subject: [PATCH 2/2] fix: typo in changeset --- .changeset/warm-mugs-clean.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/warm-mugs-clean.md b/.changeset/warm-mugs-clean.md index 85c9a5b2..2eb43067 100644 --- a/.changeset/warm-mugs-clean.md +++ b/.changeset/warm-mugs-clean.md @@ -2,4 +2,4 @@ "json-schema-studio": patch --- -search coutner resetting to valid index when search string changes +search counter resetting to valid index when search string changes