fix loading state of empty feed

This commit is contained in:
plebeius.eth
2023-07-06 13:14:20 +02:00
parent 02ce0a5474
commit 87fcc80898
6 changed files with 20 additions and 20 deletions
+3 -3
View File
@@ -585,7 +585,7 @@ const All = () => {
<Link to={`/p/all/catalog`}>Catalog</Link>
]
</div>
{feed.length > 0 ? (
{feed ? (
null
) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -601,7 +601,7 @@ const All = () => {
<Tooltip id="tooltip" className="tooltip" />
<BoardForm selectedStyle={selectedStyle}>
<div className="board">
{feed.length > 0 ? (
{feed ? (
<Virtuoso
increaseViewportBy={2000}
data={selectedFeed}
@@ -2068,7 +2068,7 @@ const All = () => {
}}
endReached={tryLoadMore}
useWindowScroll={true}
components={{ Footer: hasMore ? () => <PostLoader /> : null }}
components={{ Footer: hasMore && feed ? () => <PostLoader /> : null }}
/>
) : (
<PostLoader />
+2 -2
View File
@@ -442,7 +442,7 @@ const AllCatalog = () => {
<Link to={`/p/all`}>Return</Link>
</span>
</div>
{feed.length > 0 ? (
{feed ? (
null
) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -453,7 +453,7 @@ const AllCatalog = () => {
</TopBar>
<Tooltip id="tooltip" className="tooltip" />
<Threads selectedStyle={selectedStyle}>
{feed.length > 0 ? (
{feed ? (
<InfiniteScroll
pageStart={0}
loadMore={tryLoadMore}
+3 -3
View File
@@ -806,7 +806,7 @@ const Board = () => {
<Link to={`/p/${selectedAddress}/catalog`} onClick={()=> {window.scrollTo(0, 0)}}>Catalog</Link>
]
</div>
{feed.length > 0 ? (
{subplebbit?.state === "succeeded" ? (
<>
<span className="subscribe-button-desktop">
[
@@ -840,7 +840,7 @@ const Board = () => {
{subplebbit?.state === "failed" ? (
null
) : (
feed.length > 0 ? (
feed ? (
<>
{subplebbit.rules ?
<>
@@ -2685,7 +2685,7 @@ const Board = () => {
}}
endReached={tryLoadMore}
useWindowScroll={true}
components={{ Footer: hasMore && feed.length > 0 ? () => <PostLoader /> : null }}
components={{ Footer: hasMore && feed ? () => <PostLoader /> : null }}
/>
</>
) : (<PostLoader />)
+2 -2
View File
@@ -665,7 +665,7 @@ const Catalog = () => {
<Link to={`/p/${selectedAddress}`} onClick={()=> {window.scrollTo(0, 0)}}>Return</Link>
]
</div>
{feed.length > 0 ? (
{feed ? (
<>
<span className="subscribe-button-desktop">
[
@@ -699,7 +699,7 @@ const Catalog = () => {
{subplebbit?.state === "failed" ? (
null
) : (
feed.length > 0 ? (
feed ? (
<InfiniteScroll
pageStart={0}
loadMore={tryLoadMore}
+7 -7
View File
@@ -408,9 +408,9 @@ const Subscriptions = () => {
setCommentCid(comment.cid);
setOriginalCommentContent(comment.content);
setIsEditModalOpen(true);
}
};
useEffect(() => {
setPublishCommentEditOptions((prevOptions) => ({
...prevOptions,
@@ -563,7 +563,7 @@ const Subscriptions = () => {
</div>
<>
<div className="board-title">Subscriptions</div>
{feed.length < 1 ? (
{account.subscriptions.length < 1 ? (
<div className="board-address">You haven't subscribed to any board yet.</div>
) : (
<div className="board-address">
@@ -593,7 +593,7 @@ const Subscriptions = () => {
<Link to={`/p/subscriptions/catalog`}>Catalog</Link>
]
</div>
{feed.length > 0 ? (
{feed ? (
null
) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -609,7 +609,7 @@ const Subscriptions = () => {
<Tooltip id="tooltip" className="tooltip" />
<BoardForm selectedStyle={selectedStyle}>
<div className="board">
{ feed.length < 1 ? (
{ feed ? (
null
) : (
<Virtuoso
@@ -2078,7 +2078,7 @@ const Subscriptions = () => {
}}
endReached={tryLoadMore}
useWindowScroll={true}
components={{ Footer: hasMore ? () => <PostLoader /> : null }}
components={{ Footer: hasMore && feed ? () => <PostLoader /> : null }}
/>
)}
</div>
@@ -411,7 +411,7 @@ const SubscriptionsCatalog = () => {
</div>
<>
<div className="board-title">Subscriptions</div>
{feed.length < 1 ? (
{account.subscriptions.length < 1 ? (
<div className="board-address">You haven't subscribed to any board yet.</div>
) : (
<div className="board-address">
@@ -446,7 +446,7 @@ const SubscriptionsCatalog = () => {
<Link to={`/p/subscriptions`}>Return</Link>
</span>
</div>
{feed.length > 0 ? (
{feed ? (
null
) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -457,7 +457,7 @@ const SubscriptionsCatalog = () => {
</TopBar>
<Tooltip id="tooltip" className="tooltip" />
<Threads selectedStyle={selectedStyle}>
{feed.length > 0 ? (
{feed ? (
<InfiniteScroll
pageStart={0}
loadMore={tryLoadMore}