Skip to content

Commit

Permalink
fix(filter): ensure consistency in Language filter checkbox selection (
Browse files Browse the repository at this point in the history
…#1557)

- Fixes issue where selecting a language did not check the corresponding checkbox.
- Prevents duplicate selections of the same language.
- Ensures deselecting a language updates the checkbox and options properly.

Closes #1519

Co-authored-by: Priyankar Pal <[email protected]>
  • Loading branch information
Arun-cn and priyankarpal authored Oct 19, 2024
1 parent ab972cd commit 5bea781
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/common/search/FilterPlays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ const FilterPlays = ({ onChange, query }) => {

useEffect(() => {
if (!loading && !error) {
data.languages = [
{
name: 'JavaScript',
value: 'js',
icon: 'https://res.cloudinary.com/dgtdljyul/image/upload/v1675411496/js_jjnhvy.png'
},
{
name: 'TypeScript',
value: 'ts',
icon: 'https://res.cloudinary.com/dgtdljyul/image/upload/v1675409456/ts_yrzjge.png'
}
];
setLoadedData(data);
const updatedData = {
...data,
languages: [
{
name: 'JavaScript',
value: 'js',
icon: 'https://res.cloudinary.com/dgtdljyul/image/upload/v1675411496/js_jjnhvy.png'
},
{
name: 'TypeScript',
value: 'ts',
icon: 'https://res.cloudinary.com/dgtdljyul/image/upload/v1675409456/ts_yrzjge.png'
}
]
};
setLoadedData(updatedData);
}
}, [query, loading, showModal]);

Expand Down

0 comments on commit 5bea781

Please sign in to comment.