-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(index): add search function #181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for tackling this! Looks good; I just had one suggestion.
My other concern is the fact that we're using paging and caching now. I was thinking the search filter would send an actual search query to github and fetch results frrom there. If we just filter what's in the cards variable, it could miss things if they haven't all been loaded. Not sure if it makes sense to add in the meantime (since it could lead to bug reports about the search missing things). Thoughts @CharlieS1103 ?
Co-authored-by: Isaac <[email protected]>
Also I've found out that sending requests continuously to GitHub's Search API can eventually lead to a bottleneck as
|
Yes, we would have to throttle it or something. Or use a hybrid where we search the cards like you're currently doing sometimes maybe 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! Seems all good to me. One functionality we may want to add in the future is searching by tag.
Just took a second look and seems like we may run into issues using github requests, might need to migrate the onchange to use the caching system i implemented |
I'm pretty sure if we were to use GitHub API for search queries it wouldn't be much of a problem to implement a hybrid system as this is possible if (allThemes.incomplete_results === true) {
// Filter results from cache
} I'm not sure about how to deal with the throttle part tho, gonna have to look into it a bit more. |
I've found out also that if you were to send an incomplete keyword (such as |
Oh I have yet to implement GitHub API calls for search queries so I don't think that's a problem yet |
Woah, that is bizarre. I think the best solution for rate limits etc would be to actually just not have live search and to have it load a search page when you hit enter. That solves the query issue, and people will type the entire thing in. We could also do your card filtering method for live results, and then have a full search page if they press enter. Thoughts? |
That is a pretty good idea, I agree. I was thinking about caching the initial results also, and if GitHub returns 0 results we could filter out from the cache and give the results from there. Oh and please feel free to commit directly to the PR once you find a working solution :) . I might not be able to find one in a timely manner (mainly because this is the first time I've worked with React) so I'd appreciate any help also. |
Now filters existing results upon input, fetch live GitHub API results (aka. refresh results) upon pressing Enter key |
Hey sorry, I've been super busy lately. Really do appreciate the contributions though. I'll look as soon as I can. Wanna get the code running locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading icon is sweet! I have a couple suggestions. I'd also like it mention that we are (I am) in the process of converting the app to be built with Spicetify-Creator, which lets us use jsx and typescript and other niceties. So these changes will need to be replicated once that is ready. Do you think you'd be able to get the functionality moved over once we've moved?
Sure, I'll look into it! Do give me a mention on GitHub or Discord once you need it going. |
Co-authored-by: Isaac <[email protected]>
Going to go ahead and just merge this in, we'll get it moved over to JSX when the time comes. |
Adds search function for Marketplace (or at least finishes it), thought this was much needed
Currently compare search query with name/user and filters array
Line 843: Unnecessary condition ig?