Skip to content

Commit

Permalink
Address some additional feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwiebell committed May 22, 2019
1 parent d54790e commit 96f5475
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/venia-concept/src/RootComponents/Category/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@ const Category = props => {
currentPage: Number(currentPage)
}
});
}, [id, pageSize, currentPage]);

useEffect(() => {
window.scrollTo({
left: 0,
top: 0,
behavior: 'smooth'
});
}, [currentPage]);
}, [id, pageSize, currentPage]);

const totalPagesFromData = data
? data.category.products.page_info.total_pages
: null;
useEffect(() => {
if (data) {
setTotalPages(data.category.products.page_info.total_pages);
}
}, [data]);
setTotalPages(totalPagesFromData);
}, [totalPagesFromData]);

if (error) return <div>Data Fetch Error</div>;
if (loading && !totalPages) return loadingIndicator;
Expand Down

0 comments on commit 96f5475

Please sign in to comment.