-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
solution #1139
base: master
Are you sure you want to change the base?
solution #1139
Conversation
svitlanak31
commented
Nov 23, 2024
- DEMO LINK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the task requirements! 🎉 The code is well-structured and meets the core functionality needed. While there are minor issues with handling null
values in URL parameters, they don't significantly impact the functionality. Keep up the good work and consider refining these areas for even better code quality in the future! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
const resetFilters = { | ||
sex: null, | ||
centuries: null, | ||
query: null, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resetFilters
object sets all filter parameters to null
. However, setting URL parameters to null
might not remove them from the URL. Consider using an empty string or removing the parameters entirely to ensure they are reset properly.
if (currentSort === field && currentOrder === 'asc') { | ||
return { sort: field, order: 'desc' }; | ||
} else if (currentSort === field && currentOrder === 'desc') { | ||
return { sort: null, order: null }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning null
for sort
and order
in getNewSortParams
might not remove these parameters from the URL. Consider returning an empty object or explicitly removing these parameters to ensure they are reset properly.
}, []); | ||
|
||
const query = searchParams.get('query') || ''; | ||
const sex = searchParams.get('sex') || null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sex
parameter is set to null
if not present, which might not be ideal for filtering logic. Consider using an empty string or a default value that aligns with your filtering logic to avoid potential issues.
import { Person } from "../types"; | ||
|
||
type Filters = { | ||
sex: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sex
filter is defined as string | null
, but using null
might not be ideal for filtering logic. Consider using an empty string or a default value that aligns with your filtering logic to avoid potential issues.