Skip to content

fix: reset search counter index when search string changes#290

Open
sakshammjn wants to merge 3 commits into
ioflux-org:mainfrom
sakshammjn:fix/search-counter-reset
Open

fix: reset search counter index when search string changes#290
sakshammjn wants to merge 3 commits into
ioflux-org:mainfrom
sakshammjn:fix/search-counter-reset

Conversation

@sakshammjn

@sakshammjn sakshammjn commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a search bug where the match counter could show an invalid index after refining the search query (for example, 7/2).

The fix resets the active match index to the first valid result whenever the search results are recalculated, keeping:

  • The counter accurate
  • The highlighted node consistent with the counter
  • Navigation behavior predictable after query changes

What kind of change does this PR introduce

  • Bug fix
  • UI/UX consistency

Issue Number

Closes #281

Video

Screen.Recording.2026-04-05.at.3.37.32.PM.1.mov

Does this PR introduce a breaking change?

No

If relevant, did you update the documentation?

No, not required

Summary by CodeRabbit

  • Bug Fixes
    • Fixed search counter to properly reset to a valid index when the search string changes.

@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00ad4666-fabc-472b-a414-52717b35d1c9

📥 Commits

Reviewing files that changed from the base of the PR and between 5065591 and 5818b21.

📒 Files selected for processing (1)
  • .changeset/warm-mugs-clean.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/warm-mugs-clean.md

📝 Walkthrough

Walkthrough

A new Changeset document is added to the json-schema-studio package, documenting a patch-level bug fix that resets the search counter to a valid index whenever the search query is refined, preventing invalid counter displays like "4/2".

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/warm-mugs-clean.md
New changeset entry recording a patch-level fix for the search counter being reset to a valid index when the search string changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 The search now hops with proper grace,
No more confusing numbers face-to-face,
When queries change, the counter resets true,
Valid indices shine—four out of four, not two!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the primary change: resetting the search counter index when the search string changes, which directly addresses the bug fix.
Description check ✅ Passed The description follows the template structure with all major sections completed: summary, type of change, issue number, video demonstration, breaking changes, and documentation status.
Linked Issues check ✅ Passed The PR directly addresses issue #281 by resetting the active match index to the first valid result when search results change, meeting the expected behavior requirement that the counter never shows an invalid index.
Out of Scope Changes check ✅ Passed The changeset only adds a patch release note for the search counter fix with no other code modifications, remaining entirely within the scope of fixing issue #281.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/warm-mugs-clean.md:
- Line 5: The changelog line contains a typo "coutner" — update the text to
"counter" so the sentence reads "search counter resetting to valid index when
search string changes"; edit the string in the .changeset entry (the line
containing "search coutner") to correct the misspelling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73a64770-79fe-4b83-a141-6b4bc1586eeb

📥 Commits

Reviewing files that changed from the base of the PR and between a173afb and 5065591.

📒 Files selected for processing (2)
  • .changeset/warm-mugs-clean.md
  • src/components/GraphView.tsx

Comment thread .changeset/warm-mugs-clean.md Outdated
Signed-off-by: Saksham Mahajan <84372129+sakshammjn@users.noreply.github.com>
@github-actions

github-actions Bot commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Preview Deployed!

Item Status
Latest Deploy Visit Preview
Environment Preview (PR-290)
Action View Logs

Last updated at 2026-04-05T17:05:54Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Search counter shows invalid index after changing search string

1 participant