Skip to content

fix(types): correct search scroll anchor and refresh search results#944

Open
Nandann018-ux wants to merge 1 commit intodrawdb-io:mainfrom
Nandann018-ux:main
Open

fix(types): correct search scroll anchor and refresh search results#944
Nandann018-ux wants to merge 1 commit intodrawdb-io:mainfrom
Nandann018-ux:main

Conversation

@Nandann018-ux
Copy link

This PR fixes a bug in the Types tab search where selecting a newly created type failed to scroll the panel into view. It also ensures that the search autocomplete results stay in sync when new types are added or edited.

Motivation and Context

Previously, adding a new type and searching for it would update the list selection, but the UI wouldn't scroll to the type. This occurred because the scroll anchor was dynamically set using scroll_type_${type.id}, whereas the search selection tried to scroll using the array index (scroll_type_${index}).

This fix restores the expected navigation behavior and ensures users don't have to manually trigger a re-search to see live updates in the autocomplete dropdown.

Changes Made

  • Scroll Target Fix: Updated the scroll target logic to use the id with an index fallback to properly match the anchor. Added null-safety to the scroll call.
  • Live Sync: Added a useEffect hook to keep filteredResult synchronized with the types array and the current search value.
  • Target File: src/components/EditorSidePanel/TypesTab/SearchBar.jsx

Testing

  • npm run lint - Passed ✅
  • Note: npm run build encountered a Node out-of-memory error (FATAL ERROR: Ineffective mark-compacts near heap limit) in the test environment, but this is an environment-specific memory limit. The code changes are low-risk, localized to a single React component, and do not introduce new dependencies.

@vercel
Copy link

vercel bot commented Mar 7, 2026

@Nandann018-ux is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Nandann018-ux
Copy link
Author

Hi, I have addressed the required changes and updated the tests. Could you please review the PR?
Thanks!

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.

1 participant