-
Notifications
You must be signed in to change notification settings - Fork 16
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
Modify filter to work on selection change without button click (Fix #55) #78
base: main
Are you sure you want to change the base?
Conversation
👷 Deploy request for gitbegin pending review.Visit the deploys page to approve it
|
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.
Left a few comments, Thanks for the Video Demonstration!
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.
@ST-KO This is not the ideal way of working with immediate searches/filters, We must be a debounce (delay) before firing a query. Consider typing paragraphs/digits for some reason, it will be flooded with tons of requests as you type the text in the box, kinda like a DDOS attack if many people are using it.
We must debounce for at least 500 milliseconds (standard). That would prevent tons of queries from being fired to API.
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.
This is exactly what I was going to suggest
@@ -146,7 +146,35 @@ export default function Index() { | |||
} | |||
}, [initialIssues, showBookmarked, isBookmarked]) | |||
|
|||
const handleLanguageChange = (selectedLanguage: any) => { | |||
useEffect(() => { | |||
const formData = new FormData() |
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.
I would recommend creating a custom hook that contains all the logic of the filter and exposes only the required stuff. That way it would be easy to test (I recommend writing tests too, if you can 😉 ) and we don't need to touch _index.tsx
file while caring about filtration.
@ST-KO if you want any help please reach out to @omjogani I'm sure his experience can help you learn and implement these things. If you are hesitant to write tests, then you can leave it but if you want to learn and implement test, then @omjogani is there to help you. Remember there's no rush, take your time |
@dotslashbit @omjogani That makes more sense. Thank you so much for explaining my mistake guys. I knew it shouldn't be that simple 😅 . As for custom hook, I might take some time as I have never written custom hook before and have to learn it first. At the mean time, if you want to assign this to another contributor, I am totally ok with that. But I will still be working on it. I'll also reach out to @omjogani for help if I am stuck. Thanks guys |
@ST-KO no no there's no rush, please take your time, learn and implement. |
Open Source is all about learning and applying, We want you to implement it and comment here if you face any difficulties, more than happy to help! |
Summary
This pull request address issue #55, modifies the filter functionality to trigger automatically on change.
Changes
Related Issues
Screen Recording
Screen.Recording.2024-09-04.at.1.mp4