Skip to content

Commit

Permalink
fix: added check to stop re-render on launch-page
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 authored and birme committed Jul 12, 2024
1 parent b5ce747 commit 9a8e123
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/landing-page/use-fetch-production-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ export const useFetchProductionList = (filter?: GetProductionListFilter) => {

const [{ reloadProductionList }, dispatch] = useGlobalState();

const manageProdPaginationUpdate =
filter?.offset !== productions?.offset.toString();

useEffect(() => {
let aborted = false;

if (
reloadProductionList ||
intervalLoad ||
doInitialLoad ||
filter?.offset !== productions?.offset.toString()
// offset-param is never present on launch-page
(filter?.offset ? manageProdPaginationUpdate : false)
) {
const searchParams = new URLSearchParams(filter).toString();

Expand Down Expand Up @@ -58,7 +62,7 @@ export const useFetchProductionList = (filter?: GetProductionListFilter) => {
reloadProductionList,
doInitialLoad,
filter,
productions?.offset,
manageProdPaginationUpdate,
]);

return {
Expand Down

0 comments on commit 9a8e123

Please sign in to comment.