Refactor/use debounce hook in job browse page#333
Conversation
…e, fix active route highlighting for sub-routes
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ficx #125
Problem
JobBrowsePage.tsxmanually duplicated debounce logic usinguseRef+useEffect+setTimeoutinstead of using theexisting reusable
useDebouncehook atclient/src/hooks/useDebounce.ts.This violates DRY and makes the code harder to maintain.
Fix
Replaced manual debounce implementation with two
useDebouncecalls:const debouncedSearch = useDebounce(search, 400)const debouncedLocation = useDebounce(locationFilter, 400)Also removed:
timerRef(no longer needed)debouncedSearchanddebouncedLocationuseState declarationssubmitSearchfunction (no longer needed)useEffectanduseRefimports (no longer used)Files Changed
client/src/module/student/jobs/JobBrowsePage.tsxNote
The existing
useDebouncehook atclient/src/hooks/useDebounce.tswas already being used in other parts of the codebase. This PR
brings
JobBrowsePagein line with that pattern.Label Request
Requesting
refactorlabel for this PR.