Skip to content
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

[front] - refacto: add useDebounce hook #11470

Merged
merged 6 commits into from
Mar 19, 2025
Merged

Conversation

JulesBelveze
Copy link
Contributor

@JulesBelveze JulesBelveze commented Mar 19, 2025

Description

This PR introduces a reusable useDebounce hook to standardize debounce handling across search inputs. The hook encapsulates common debounce logic including minimum length checks, loading states, and cleanup. It replaces multiple custom debounce implementations with a single solution

Risk

Moderate, breaking search across different places

Deploy Plan

  • Deploy front-edge
  • Deploy front

 - Introduce a new custom hook to manage debounced input values and states
 - Allow configuration of debounce delay and minimum string length for updates
 - Provide immediate and debounced values along with isDebouncing state and control methods
…tion for search feature

 - Replaced custom debounce implementation with useDebounce hook for search input in InputBarAttachmentsPicker component
 - Removed unnecessary useEffect and useState for managing debounce, simplifying the component logic
 - Updated useDebounce hook to use string as the input value type for consistency and removed unnecessary type checks
…rchLayout search input

 - Integrate `useDebounce` hook to handle search input debounce logic
 - Replace manual debouncing implementation with `useDebounce`
 - Implement reset of pagination when debounced search term changes
 - Add combined loading state to handle debouncing and search state
 - Change search input value handling to update debounced value through context
 - Remove old effect for handling debounced search state transition
 - Refine effect for search hit count to consider new loading state
 - Replaced manual debouncing logic with useDebounce hook to handle search input debounce and state
 - Simplified useEffect and state management related to search input debouncing by integrating useDebounce hook
 - Removed unnecessary debouncing state variables and useEffect cleanup code
 - Replace manual debouncing implementation with useDebounce hook for search filter functionality
 - Trigger pagination reset when search filter changes using debounced value
 - Adjust loading state indicators to account for debouncing state in infinite scroll component
 - Remove manual debouncing code with useEffect and useState in favor of more concise hook usage
@JulesBelveze JulesBelveze requested a review from Fraggle March 19, 2025 13:38
Copy link
Contributor

@Fraggle Fraggle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chaud le mec !

@JulesBelveze JulesBelveze merged commit e1d7586 into main Mar 19, 2025
6 checks passed
@JulesBelveze JulesBelveze deleted the refacto/debounce-hook branch March 19, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants