Exo5 Modif The three symptoms#6
Open
axelvuillaume wants to merge 6 commits intoselego:mainfrom
Open
Conversation
Comment on lines
+83
to
+103
| const debouncedSaveSearchState = debounce(() => { | ||
| if (saveSearchState) { | ||
| localStorage.setItem('lastSearchQuery', query); | ||
| localStorage.setItem('lastSearchFilters', JSON.stringify(filters)); | ||
| } | ||
| }, 1000); | ||
|
|
||
|
|
||
| useEffect(() => { | ||
| debouncedSaveSearchState(); | ||
| return () => debouncedSaveSearchState.cancel(); | ||
| }, [query, filters]); | ||
|
|
||
| useEffect(() => { | ||
| return () => { | ||
| if (saveSearchState) { | ||
| localStorage.removeItem('lastSearchQuery'); | ||
| localStorage.removeItem('lastSearchFilters'); | ||
| } | ||
| }; | ||
| }, [query, filters, saveSearchState]); | ||
| }, [saveSearchState]); |
There was a problem hiding this comment.
éviter de laisser des localhost comme ça, autant faire tout en state ou à la rigueur enregistrer ça en base si c'est important.
Comment on lines
106
to
115
| const handleFilterChange = (e) => { | ||
| const { name, value, type, checked } = e.target; | ||
| const newValue = type === 'checkbox' ? checked : value; | ||
|
|
||
| setFilters(prev => ({ | ||
| ...prev, | ||
| [name]: type === 'checkbox' ? checked : value | ||
| [name]: newValue, | ||
| })); | ||
| setPage(1); // Reset page when filters change | ||
| }; |
There was a problem hiding this comment.
directement mettre les éléments dans les onChange et pas faire une fonction générique pour les filtres.
Comment on lines
+67
to
+72
| const categorizedProducts = products.reduce((acc, product) => { | ||
| acc[product.category] = acc[product.category] || []; | ||
| acc[product.category].push(product); | ||
| return acc; | ||
| }, {}); | ||
|
|
There was a problem hiding this comment.
on privilégie ça côté back la plus part du temps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.