From 64c857fb9d383c3ee08cec114acc11181b91d4f5 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Wed, 5 Mar 2025 22:05:20 +0100 Subject: [PATCH] chore(package.json): upgrade plebbit-react-hooks --- package.json | 2 +- src/views/board/board.tsx | 23 ++++++------ src/views/catalog/catalog.tsx | 23 ++++++------ yarn.lock | 68 +++++++++++++++++++++-------------- 4 files changed, 69 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 84d0096a..12552d55 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dependencies": { "@capacitor/app": "6.0.1", "@floating-ui/react": "0.26.1", - "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#6d35eb3b4dc84f8fdcbb46d95e3b1d78f1750b5f", + "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#54cf36c50dd31f5641a9475f5566b7b29b3873c7", "@react-spring/web": "9.7.5", "@testing-library/jest-dom": "5.14.1", "@testing-library/react": "13.0.0", diff --git a/src/views/board/board.tsx b/src/views/board/board.tsx index 9f7472f6..fbdc2252 100644 --- a/src/views/board/board.tsx +++ b/src/views/board/board.tsx @@ -20,13 +20,16 @@ import { Post } from '../post'; const lastVirtuosoStates: { [key: string]: StateSnapshot } = {}; -const threadsWithoutImagesFilter = (comment: Comment) => { - const { link, linkHeight, linkWidth, thumbnailUrl } = comment || {}; - if (!getHasThumbnail(getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight), link)) { - return false; - } - return true; -}; +const createThreadsWithoutImagesFilter = () => ({ + filter: (comment: Comment) => { + const { link, linkHeight, linkWidth, thumbnailUrl } = comment || {}; + if (!getHasThumbnail(getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight), link)) { + return false; + } + return true; + }, + key: 'threads-with-images-only', +}); const Board = () => { const { t } = useTranslation(); @@ -66,7 +69,7 @@ const Board = () => { sortType, postsPerPage: isInAllView || isInSubscriptionsView || isInModView ? 5 : 25, ...(isInAllView || isInSubscriptionsView || isInModView ? { newerThan: timeFilterSeconds } : {}), - filter: hideThreadsWithoutImages ? threadsWithoutImagesFilter : undefined, + filter: hideThreadsWithoutImages ? createThreadsWithoutImagesFilter() : undefined, }; const { feed, hasMore, loadMore, reset, subplebbitAddressesWithNewerPosts } = useFeed(feedOptions); @@ -134,13 +137,13 @@ const Board = () => { subplebbitAddresses, sortType, newerThan: 60 * 60 * 24 * 7, - filter: hideThreadsWithoutImages ? threadsWithoutImagesFilter : undefined, + filter: hideThreadsWithoutImages ? createThreadsWithoutImagesFilter() : undefined, }); const { feed: monthlyFeed } = useFeed({ subplebbitAddresses, sortType, newerThan: 60 * 60 * 24 * 30, - filter: hideThreadsWithoutImages ? threadsWithoutImagesFilter : undefined, + filter: hideThreadsWithoutImages ? createThreadsWithoutImagesFilter() : undefined, }); const feedLength = feed.length; diff --git a/src/views/catalog/catalog.tsx b/src/views/catalog/catalog.tsx index 0beb6d24..09f0f2e5 100644 --- a/src/views/catalog/catalog.tsx +++ b/src/views/catalog/catalog.tsx @@ -20,13 +20,16 @@ import styles from './catalog.module.css'; const lastVirtuosoStates: { [key: string]: StateSnapshot } = {}; -const threadsWithoutImagesFilter = (comment: Comment) => { - const { link, linkHeight, linkWidth, thumbnailUrl } = comment || {}; - if (!getHasThumbnail(getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight), link)) { - return false; - } - return true; -}; +const createThreadsWithoutImagesFilter = () => ({ + filter: (comment: Comment) => { + const { link, linkHeight, linkWidth, thumbnailUrl } = comment || {}; + if (!getHasThumbnail(getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight), link)) { + return false; + } + return true; + }, + key: 'threads-with-images-only', +}); const Catalog = () => { const { t } = useTranslation(); @@ -79,7 +82,7 @@ const Catalog = () => { subplebbitAddresses, sortType, postsPerPage: isInAllView || isInSubscriptionsView ? 10 : postsPerPage, - filter: hideThreadsWithoutImages ? threadsWithoutImagesFilter : undefined, + filter: hideThreadsWithoutImages ? createThreadsWithoutImagesFilter() : undefined, }; if (isInAllView || isInSubscriptionsView) { @@ -143,13 +146,13 @@ const Catalog = () => { subplebbitAddresses, sortType, newerThan: 60 * 60 * 24 * 7, - filter: hideThreadsWithoutImages ? threadsWithoutImagesFilter : undefined, + filter: hideThreadsWithoutImages ? createThreadsWithoutImagesFilter() : undefined, }); const { feed: monthlyFeed } = useFeed({ subplebbitAddresses, sortType, newerThan: 60 * 60 * 24 * 30, - filter: hideThreadsWithoutImages ? threadsWithoutImagesFilter : undefined, + filter: hideThreadsWithoutImages ? createThreadsWithoutImagesFilter() : undefined, }); const [showMorePostsSuggestion, setShowMorePostsSuggestion] = useState(false); diff --git a/yarn.lock b/yarn.lock index 42d0b932..6b251947 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3069,6 +3069,22 @@ dependencies: debug "4.3.4" +"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#54cf36c50dd31f5641a9475f5566b7b29b3873c7": + version "0.0.1" + resolved "https://github.com/plebbit/plebbit-react-hooks.git#54cf36c50dd31f5641a9475f5566b7b29b3873c7" + dependencies: + "@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#5ff48e9b9a906a098a51b474a52692eebfb6561d" + "@plebbit/plebbit-logger" "https://github.com/plebbit/plebbit-logger.git" + assert "2.0.0" + ethers "5.6.9" + localforage "1.10.0" + lodash.isequal "4.5.0" + memoizee "0.4.15" + quick-lru "5.1.1" + uint8arrays "3.1.1" + uuid "8.3.2" + zustand "4.0.0" + "@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#6d35eb3b4dc84f8fdcbb46d95e3b1d78f1750b5f": version "0.0.1" resolved "https://github.com/plebbit/plebbit-react-hooks.git#6d35eb3b4dc84f8fdcbb46d95e3b1d78f1750b5f" @@ -3976,6 +3992,21 @@ dependencies: "@types/node" "*" +"@typescript-eslint/eslint-plugin@8.26.0": + version "8.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.26.0.tgz#7e880faf91f89471c30c141951e15f0eb3a0599e" + integrity sha512-cLr1J6pe56zjKYajK6SSSre6nl1Gj6xDp1TY0trpgPzjVbgDwd09v2Ws37LABxzkicmUjhEeg/fAUjPJJB1v5Q== + dependencies: + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "8.26.0" + "@typescript-eslint/type-utils" "8.26.0" + "@typescript-eslint/utils" "8.26.0" + "@typescript-eslint/visitor-keys" "8.26.0" + graphemer "^1.4.0" + ignore "^5.3.1" + natural-compare "^1.4.0" + ts-api-utils "^2.0.1" + "@typescript-eslint/eslint-plugin@^5.5.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" @@ -3992,21 +4023,6 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/eslint-plugin@^8.26.0": - version "8.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.26.0.tgz#7e880faf91f89471c30c141951e15f0eb3a0599e" - integrity sha512-cLr1J6pe56zjKYajK6SSSre6nl1Gj6xDp1TY0trpgPzjVbgDwd09v2Ws37LABxzkicmUjhEeg/fAUjPJJB1v5Q== - dependencies: - "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "8.26.0" - "@typescript-eslint/type-utils" "8.26.0" - "@typescript-eslint/utils" "8.26.0" - "@typescript-eslint/visitor-keys" "8.26.0" - graphemer "^1.4.0" - ignore "^5.3.1" - natural-compare "^1.4.0" - ts-api-utils "^2.0.1" - "@typescript-eslint/experimental-utils@^5.0.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.62.0.tgz#14559bf73383a308026b427a4a6129bae2146741" @@ -4014,6 +4030,17 @@ dependencies: "@typescript-eslint/utils" "5.62.0" +"@typescript-eslint/parser@8.26.0": + version "8.26.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.26.0.tgz#9b4d2198e89f64fb81e83167eedd89a827d843a9" + integrity sha512-mNtXP9LTVBy14ZF3o7JG69gRPBK/2QWtQd0j0oH26HcY/foyJJau6pNUez7QrM5UHnSvwlQcJXKsk0I99B9pOA== + dependencies: + "@typescript-eslint/scope-manager" "8.26.0" + "@typescript-eslint/types" "8.26.0" + "@typescript-eslint/typescript-estree" "8.26.0" + "@typescript-eslint/visitor-keys" "8.26.0" + debug "^4.3.4" + "@typescript-eslint/parser@^5.5.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" @@ -4024,17 +4051,6 @@ "@typescript-eslint/typescript-estree" "5.62.0" debug "^4.3.4" -"@typescript-eslint/parser@^8.26.0": - version "8.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.26.0.tgz#9b4d2198e89f64fb81e83167eedd89a827d843a9" - integrity sha512-mNtXP9LTVBy14ZF3o7JG69gRPBK/2QWtQd0j0oH26HcY/foyJJau6pNUez7QrM5UHnSvwlQcJXKsk0I99B9pOA== - dependencies: - "@typescript-eslint/scope-manager" "8.26.0" - "@typescript-eslint/types" "8.26.0" - "@typescript-eslint/typescript-estree" "8.26.0" - "@typescript-eslint/visitor-keys" "8.26.0" - debug "^4.3.4" - "@typescript-eslint/scope-manager@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c"