Refactor use-search to use a properly-typed fuzzy-search library
See original GitHub issueBrief
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:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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.