From ccce8cecccc1f0ee8715f656e97e329f68225618 Mon Sep 17 00:00:00 2001 From: wil Date: Wed, 21 Feb 2024 15:36:32 -0500 Subject: [PATCH] seems like all bugs are killed --- packages/components/src/api/index.tsx | 4 +- .../SelectModalWeightsTabs/tabAllWeights.tsx | 38 ++++++++++--------- .../tabBookmarkedWeights.tsx | 6 +-- .../pageWorkflowControls.tsx | 1 - 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/components/src/api/index.tsx b/packages/components/src/api/index.tsx index 7e53f0301f..cdfa1d7034 100644 --- a/packages/components/src/api/index.tsx +++ b/packages/components/src/api/index.tsx @@ -1,13 +1,12 @@ +import { FetchStatus } from "./_common/SharedFetchTypes"; import { MediaFileType, GetMediaByUser } from "./media_files"; - import { Weight, ListWeights } from "./weights"; - import { GetBookmarksByUser } from "./bookmarks/GetBookmarksByUser"; @@ -17,6 +16,7 @@ export type{ Weight } export { + FetchStatus, GetBookmarksByUser, GetMediaByUser, ListWeights diff --git a/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabAllWeights.tsx b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabAllWeights.tsx index f9f3dc0782..68e838ab46 100644 --- a/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabAllWeights.tsx +++ b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabAllWeights.tsx @@ -3,9 +3,10 @@ import { useBookmarks, useLazyLists, useRatings, - // useSession } from "hooks"; + import { + FetchStatus, Weight as WeightI, ListWeights } from "@storyteller/components/src/api"; @@ -77,28 +78,29 @@ export default function WeightsTabsContent({ }); useEffect(()=>{ - - if(weights.next && lazyPages.hasNext && - (currPageIndex+1)*pageSize >= weights.list.length){ + if (weights.next && lazyPages.hasNext + && (currPageIndex+1)*pageSize >= weights.list.length + && weights.status === FetchStatus.success + ){ //preload nextPage - console.log('getMore') + // if(debug) console.log('useEffect: getMore') weights.getMore(); } - },[weights, currPageIndex]); + },[weights, currPageIndex, lazyPages.hasNext]); const handlePageChange = (selectedItem: { selected: number }) => { - console.log(`selected page: ${selectedItem.selected}`) - const startIdx = selectedItem.selected * 9 - const endIdx = (selectedItem.selected+1)*9 <= weights.list.length + if(debug)console.log(`selected page: ${selectedItem.selected}`) + const startIdx = selectedItem.selected * 9 + const endIdx = (selectedItem.selected+1)*9 <= weights.list.length ? (selectedItem.selected+1)*9 : weights.list.length; - if (debug) console.log(`should slice ${startIdx}-${endIdx}`) - if (debug) console.log(weights.list) - setLazyPages((prevState)=>({ - ...prevState, - currPageWeights: weights.list.slice(startIdx,endIdx), - currPageIndex: selectedItem.selected, - })); - // } + if (debug) console.log(`should slice ${startIdx}-${endIdx}`) + if (debug) console.log(weights.list) + setLazyPages((prevState)=>({ + ...prevState, + currPageWeights: weights.list.slice(startIdx,endIdx), + currPageIndex: selectedItem.selected, + })); + // } }; const paginationProps = { @@ -128,7 +130,7 @@ export default function WeightsTabsContent({ console.log("Layout complete!")} + onLayoutComplete={() => {if(debug)console.log("Layout complete!")}} > {currPageWeights.map((data: any, key: number) => { let props = { diff --git a/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabBookmarkedWeights.tsx b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabBookmarkedWeights.tsx index 566ff32fc7..0a4e7c3e2f 100644 --- a/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabBookmarkedWeights.tsx +++ b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/tabBookmarkedWeights.tsx @@ -48,8 +48,8 @@ export default function WeightsTabsContent({ const handlePageClick = (selectedItem: { selected: number }) => { weights.pageChange(selectedItem.selected); }; - console.log("BOOKMARKED"); - console.log(weights); + // console.log("BOOKMARKED"); + // console.log(weights); const paginationProps = { onPageChange: handlePageClick, pageCount: weights.pageCount + 1, @@ -79,7 +79,7 @@ export default function WeightsTabsContent({ } console.log("Layout complete!")} + onLayoutComplete={() => {if(debug)console.log("Layout complete!")}} > {weights.list.map((data: any, key: number) => { //TODO: data should be TYPED diff --git a/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx b/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx index b545ffb841..5ccec551bd 100644 --- a/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx @@ -167,7 +167,6 @@ export default function PageFilterControls({