-
Notifications
You must be signed in to change notification settings - Fork 85
MM2 1479 Fix: PLP issues, remove PLP fetch limit to 20, fix pagination, add loading state #221
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
base: test
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| useEffect(() => { | ||
| handleSetProducts() | ||
| }, [items.length]) | ||
| if (items.length > 0) { |
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.
is there any chance for items to be undefined?
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.
useHits returns empty array if there's no items
| const searchParams = useSearchParams() | ||
|
|
||
| const itemsKey = useMemo( | ||
| () => items.map((item) => item.objectID).join(","), |
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.
is there any chance for items to be undefined?
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.
useHits returns empty array if there's no items
| <SkeletonProductCard key={idx} /> | ||
| ))} | ||
| </div> | ||
| ) : !items.length ? ( |
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.
how about extracting 'no results view' and products view to separate component to remove this chained ternary operator?
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.
Extracted the views. Also moved pagination component, it's now centered relative to the right section (not full page width like before), according to the design
| apiProducts, | ||
| }: Props) => ( | ||
| <div className="w-full"> | ||
| <ul className="flex flex-wrap gap-4"> |
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.
If we use <ul> here, we want to either wrap ProductCard in <li></li> to be semanticly correct, or change <ul> to <div>
MM2-1479