From 415c38ef64350ad880ff7932d306110dfeaa59e0 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 23 Aug 2024 11:58:11 +0800 Subject: [PATCH 1/6] Show the top loading bar even if cached items are being displayed during load --- .../templates/library/LibraryContainer.tsx | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/packages/web/components/templates/library/LibraryContainer.tsx b/packages/web/components/templates/library/LibraryContainer.tsx index 6bb4829bd..84c39fee9 100644 --- a/packages/web/components/templates/library/LibraryContainer.tsx +++ b/packages/web/components/templates/library/LibraryContainer.tsx @@ -122,7 +122,6 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element { fetchNextPage, fetchPreviousPage, hasNextPage, - hasPreviousPage, error: fetchItemsError, } = useGetLibraryItems(props.folder ?? 'home', props.folder, queryInputs) @@ -797,33 +796,6 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element { [itemsPages, multiSelectMode, checkedItems] ) - // return ( - // Loading...} - // endMessage={ - //

- // Yay! You have seen it all - //

- // } - // > - // {libraryItems.map((item) => { - // return ( - // { - // router.push(`/${viewerData?.profile.username}/${item.node.slug}`) - // }} - // > - // {item.cursor}: {item.node.title} - // - // ) - // })} - //
- // ) - return ( )} - {props.isValidating && props.items.length == 0 && } + {props.isValidating && }
{ if ( From 94f2b5eda1bc15b538e18fbe461dad8cc7a571d1 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 23 Aug 2024 12:58:30 +0800 Subject: [PATCH 2/6] Add some debug info --- .../web/components/templates/library/LibraryContainer.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/web/components/templates/library/LibraryContainer.tsx b/packages/web/components/templates/library/LibraryContainer.tsx index 84c39fee9..ed9bca218 100644 --- a/packages/web/components/templates/library/LibraryContainer.tsx +++ b/packages/web/components/templates/library/LibraryContainer.tsx @@ -122,9 +122,14 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element { fetchNextPage, fetchPreviousPage, hasNextPage, + status, error: fetchItemsError, } = useGetLibraryItems(props.folder ?? 'home', props.folder, queryInputs) + console.log( + `status ${status}, isLoading: ${isLoading}, isFetching: ${isFetching}` + ) + useEffect(() => { if (queryValue.startsWith('#')) { debouncedFetchSearchResults( @@ -1022,6 +1027,8 @@ export function LibraryItemsLayout( isSessionStorage: false, }) + console.log('props.isValidating: ', props.isValidating) + return ( <> Date: Fri, 23 Aug 2024 13:29:16 +0800 Subject: [PATCH 3/6] Use isFetching to show items are being refreshed --- packages/web/components/templates/library/LibraryContainer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/web/components/templates/library/LibraryContainer.tsx b/packages/web/components/templates/library/LibraryContainer.tsx index ed9bca218..b7095a0ae 100644 --- a/packages/web/components/templates/library/LibraryContainer.tsx +++ b/packages/web/components/templates/library/LibraryContainer.tsx @@ -374,6 +374,7 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element { }) return } + showSuccessToast(`Item deleted`, { position: 'bottom-right', }) @@ -833,7 +834,7 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element { loadMore={fetchNextPage} hasMore={hasNextPage ?? false} hasData={!!itemsPages} - isValidating={isLoading || isFetchingNextPage} + isValidating={isLoading || isFetching || isFetchingNextPage} fetchItemsError={!!fetchItemsError} labelsTarget={labelsTarget} setLabelsTarget={setLabelsTarget} From 11070acc26d822f1b1d768075cf0038dd27dfaa7 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 23 Aug 2024 13:29:27 +0800 Subject: [PATCH 4/6] Add some debug --- packages/web/lib/toastHelpers.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/web/lib/toastHelpers.tsx b/packages/web/lib/toastHelpers.tsx index 5343acfdd..cc1e23ab3 100644 --- a/packages/web/lib/toastHelpers.tsx +++ b/packages/web/lib/toastHelpers.tsx @@ -147,6 +147,7 @@ const showToastWithAction = ( } export const showSuccessToast = (message: string, options?: ToastOptions) => { + console.trace('showing success toast') return showToast(message, '#55B938', 'success', { position: 'bottom-right', ...options, From 6ed28358e62e1949d1dd1bd457be18ace2cef49c Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 23 Aug 2024 13:51:43 +0800 Subject: [PATCH 5/6] Remove typo --- packages/web/pages/[username]/[slug]/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/web/pages/[username]/[slug]/index.tsx b/packages/web/pages/[username]/[slug]/index.tsx index 087c7ed06..5153a53cf 100644 --- a/packages/web/pages/[username]/[slug]/index.tsx +++ b/packages/web/pages/[username]/[slug]/index.tsx @@ -470,7 +470,6 @@ export default function Reader(): JSX.Element { libraryItem?.slug ) - new Error() if ( articleFetchError && 'message' in articleFetchError && From d1ce129504782bf301ea107c0e7d54a4fcf82e4f Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 23 Aug 2024 13:57:31 +0800 Subject: [PATCH 6/6] Some more logging --- .../templates/article/ArticleContainer.tsx | 27 +++++++++---------- .../web/pages/[username]/[slug]/index.tsx | 1 + 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/packages/web/components/templates/article/ArticleContainer.tsx b/packages/web/components/templates/article/ArticleContainer.tsx index bd319eaaf..1e5af9281 100644 --- a/packages/web/components/templates/article/ArticleContainer.tsx +++ b/packages/web/components/templates/article/ArticleContainer.tsx @@ -123,21 +123,16 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element { props.highlightOnRelease ) // iOS app embed can overide the original margin and line height - const [maxWidthPercentageOverride, setMaxWidthPercentageOverride] = useState< - number | null - >(null) - const [lineHeightOverride, setLineHeightOverride] = useState( - null - ) - const [fontFamilyOverride, setFontFamilyOverride] = useState( - null - ) - const [highContrastTextOverride, setHighContrastTextOverride] = useState< - boolean | undefined - >(undefined) - const [justifyTextOverride, setJustifyTextOverride] = useState< - boolean | undefined - >(undefined) + const [maxWidthPercentageOverride, setMaxWidthPercentageOverride] = + useState(null) + const [lineHeightOverride, setLineHeightOverride] = + useState(null) + const [fontFamilyOverride, setFontFamilyOverride] = + useState(null) + const [highContrastTextOverride, setHighContrastTextOverride] = + useState(undefined) + const [justifyTextOverride, setJustifyTextOverride] = + useState(undefined) const highlightHref = useRef( window.location.hash ? window.location.hash.split('#')[1] : null ) @@ -388,6 +383,8 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element { ) }, [props.article.recommendations]) + console.log('props.article', props.article) + return ( <> } + console.log('library item: ', libraryItem) return (