Closed thanhnguyen2187 closed 9 months ago
Would it work if there is a lot of data?
export const displaySnippetsStore = derived( [localSnippetStore, globalTagsStore, globalSearchStore], ([localSnippets, globalTags, globalSearch]) => { globalSearch = globalSearch.toLowerCase() const filteredSnippets = localSnippets.filter( snippet => { const snippetTags = new Set(snippet.tags) const searchingFound = snippet.name.toLowerCase().includes(globalSearch) || snippet.text.toLowerCase().includes(globalSearch) // make sure that the snippet's tags include every global tag const taggingFound = Array .from(globalTags.keys()) .every(globalTag => snippetTags.has(globalTag)) return searchingFound && taggingFound } ) return filteredSnippets } )
Should not be a problem after #26.
Would it work if there is a lot of data?