diff --git a/src/cra-project/components/ProjectList/CardsContainer.jsx b/src/cra-project/components/ProjectList/CardsContainer.jsx index fc4da2f..0bf53d1 100644 --- a/src/cra-project/components/ProjectList/CardsContainer.jsx +++ b/src/cra-project/components/ProjectList/CardsContainer.jsx @@ -85,14 +85,24 @@ export default class CardsContainer extends React.Component { // Search input handler handleChange(event) { - this.inputValue = event.currentTarget.value; - - this.inputValue = this.inputValue.trim(); - this.inputValue = this.inputValue.toLowerCase(); - - this.handleFilterListUpdate(this.value); + this.inputValue = event.target.value.trim().toLowerCase(); + this.handleFilterListUpdate(this.state.value); } + //debounce functionality in searh + // handleChange(event) { + // const newInput = event.target.value.trim().toLowerCase(); + // this.inputValue = newInput; + + // // 🔁 Clear the previous debounce timer if still waiting + // if (this.debounceTimeout) clearTimeout(this.debounceTimeout); + + // // ⏳ Set a new debounce timer (300ms) + // this.debounceTimeout = setTimeout(() => { + // this.handleFilterListUpdate(this.state.value); // 🔍 Run filtering logic + // }, 300); // ⏱️ Delay (in milliseconds) + // } + sortArrayRandom(array) { if (Array.isArray(array)) { return array.sort(() => 0.5 - Math.random());