Skip to content

Commit

Permalink
use talon prop
Browse files Browse the repository at this point in the history
Signed-off-by: sirugh <rugh@adobe.com>
  • Loading branch information
sirugh committed May 25, 2021
1 parent c3c61a6 commit e803dc5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions packages/peregrine/lib/talons/WishlistPage/useWishlistPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export const useWishlistPage = (props = {}) => {

return {
errors,
wishlists: derivedWishlists,
loading
loading,
shouldRenderVisibilityToggle: derivedWishlists.length > 1,
wishlists: derivedWishlists
};
};

Expand Down Expand Up @@ -78,5 +79,7 @@ export const useWishlistPage = (props = {}) => {
* @typedef {Object} WishlistPageProps
*
* @property {Map} errors A map of all the GQL query errors
* @property {Boolean} loading is the query loading
* @property {Boolean} shouldRenderVisibilityToggle true if wishlists length is > 1.
* @property {Object} wishlists List of all customer wishlists
*/
11 changes: 8 additions & 3 deletions packages/venia-ui/lib/components/WishlistPage/wishlistPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import CreateWishlist from './createWishlist';

const WishlistPage = props => {
const talonProps = useWishlistPage();
const { errors, wishlists, loading } = talonProps;
const {
errors,
loading,
shouldRenderVisibilityToggle,
wishlists
} = talonProps;
const { formatMessage } = useIntl();
const error = errors.get('getCustomerWishlistQuery');

Expand All @@ -27,10 +32,10 @@ const WishlistPage = props => {
<Wishlist
key={wishlist.id}
data={wishlist}
shouldRenderVisibilityToggle={wishlists.length > 1}
shouldRenderVisibilityToggle={shouldRenderVisibilityToggle}
/>
));
}, [wishlists]);
}, [shouldRenderVisibilityToggle, wishlists]);

if (loading && !error) {
return fullPageLoadingIndicator;
Expand Down

0 comments on commit e803dc5

Please sign in to comment.