question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor use-search to use a properly-typed fuzzy-search library

See original GitHub issue

Brief

The current useSearch() implementation uses the itemsjs library, which has no proper typings. This leads to useSearch() being littered with any type annotations.

We want to avoid using any if possible. Therefore, we should migrate to a search library with proper typings (e.g. fusejs).

Definition of done

  • use-search properly migrated to a library with valid typings.
  • All any are replaced by correct typings.

Tasks

  • Migrate to a properly typed fuzzy search library
  • Refactor use-search to use fusejs and add proper typings

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
mazipancommented, Jul 21, 2021

Since this issue is classified as hard-level. I think it’s better if we introduce an automated testing first for this component before go on the refactoring part.

The hard part is you need to tackle all cases, testing it, make sure it’s not breaking. From my personal experience, testing using a manual way when you’re not the original creator is very risky.

@resir014 @zainfathoni

2reactions
mazipancommented, Jul 20, 2021

Itemsjs

https://bundlephobia.com/package/itemsjs@2.1.10

Size: 64kB Minified: 20kB

Fuse.js

https://bundlephobia.com/package/fuse.js@6.4.6

Size: 15kB Minified: 5kB

But yes, this is a big refactor. Since you will face many differences between this two libraries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate to typesense as search backend · Issue #374 - GitHub
Refactor the components into reusable components in the design system #379 ... Refactor use-search to use a properly-typed fuzzy-search library #197.
Read more >
What is Fuse.js? | Fuse.js
Lightweight fuzzy-search library, in JavaScript. ... Fuse.js is a powerful, lightweight fuzzy-search library, with zero dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found