chore(deps): use published bitsocial react hooks

This commit is contained in:
Tommaso Casaburi
2026-04-20 22:11:36 +07:00
parent 338f415f2a
commit c046c542b6
120 changed files with 169 additions and 169 deletions
+2 -2
View File
@@ -23,12 +23,12 @@ const testState = vi.hoisted(() => ({
communitySnapshot: undefined as unknown,
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
useAccount: () => testState.account,
useAccountCommunities: () => ({ accountCommunities: testState.accountCommunities }),
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/utils', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/utils', () => ({
flattenCommentsPages: () => testState.flattenedReplies,
}));
@@ -17,7 +17,7 @@ const testState = vi.hoisted(() => ({
publishCommentMock: vi.fn(async () => undefined),
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
deleteComment: (targetComment: string | number) => testState.deleteCommentMock(targetComment),
usePublishComment: (options: Record<string, any> | undefined) => {
testState.lastPublishOptions = options;
@@ -18,7 +18,7 @@ const testState = vi.hoisted(() => ({
xhrResponses: new Map<string, { response?: ArrayBuffer; status: number; statusText: string }>(),
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
default: {
createInstance: () => ({
getItem: testState.cacheGetItemMock,
@@ -21,7 +21,7 @@ const testState = vi.hoisted(() => ({
replies: [] as TestComment[],
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
useAccountComments: (options?: { commentIndices?: number[] }) => {
testState.accountCommentsCalls.push(options);
@@ -19,14 +19,14 @@ const testState = vi.hoisted(() => ({
},
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
useFeed: (options: Record<string, unknown> | undefined) => {
testState.preloadOptions = options;
return { feed: testState.preloadFeed };
},
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/feeds', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/feeds', () => ({
default: (selector: (state: { feedsOptions: Record<string, unknown>; loadedFeeds: Record<string, unknown> }) => unknown) =>
selector({
feedsOptions: testState.feedsOptions,
@@ -17,7 +17,7 @@ const testState = vi.hoisted(() => ({
publishCommentMock: vi.fn(),
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
usePublishComment: (options: Record<string, any>) => {
testState.lastPublishOptions = options;
return {
@@ -27,7 +27,7 @@ vi.mock('react-i18next', () => ({
}),
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
useAccount: () => testState.account,
usePublishComment: (options: Record<string, any>) => {
testState.lastPublishOptions = options;
@@ -12,7 +12,7 @@ const testState = vi.hoisted(() => ({
replies: [] as Array<Record<string, unknown>>,
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({}));
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({}));
let container: HTMLDivElement;
let latestValue: ReturnType<typeof useQuotedByMap>;
@@ -14,7 +14,7 @@ const testState = vi.hoisted(() => ({
options: undefined as { accountName?: string; commentCid?: string; commentIndex?: number | string } | undefined,
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
useAccount: (options?: { accountName?: string }) => {
if (!options?.accountName) {
return testState.account;
@@ -11,7 +11,7 @@ const testState = vi.hoisted(() => ({
communities: {} as Record<string, unknown>,
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities', () => ({
default: (selector: (state: { communities: typeof testState.communities }) => unknown) =>
selector({
communities: testState.communities,
@@ -19,7 +19,7 @@ const testState = vi.hoisted(() => ({
communitiesStates: {} as Record<string, { clientUrls: string[]; communityAddresses: string[] }>,
}));
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
useClientsStates: () => ({
states: testState.clientsStates,
}),
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useAccountCommunities } from '@bitsocialnet/bitsocial-react-hooks';
import { useAccountCommunities } from '@bitsocial/bitsocial-react-hooks';
import type { DirectoryCommunity } from './use-directories';
export const useAccountCommunitiesWithMetadata = (): DirectoryCommunity[] => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useAccountCommunities } from '@bitsocialnet/bitsocial-react-hooks';
import { useAccountCommunities } from '@bitsocial/bitsocial-react-hooks';
export const useAccountCommunityAddresses = (): string[] => {
const { accountCommunities } = useAccountCommunities({ onlyIfCached: true });
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useAccount } from '@bitsocialnet/bitsocial-react-hooks';
import { useAccount } from '@bitsocial/bitsocial-react-hooks';
import { useCommunityField } from './use-stable-community';
interface AuthorPrivilegesProps {
+1 -1
View File
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { create } from 'zustand';
import { useCommunityStats } from '@bitsocialnet/bitsocial-react-hooks';
import { useCommunityStats } from '@bitsocial/bitsocial-react-hooks';
import { useCommunityIdentifier } from './use-community-identifiers';
type CommunityStatsState = {
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import type { CommunityIdentifier } from '@bitsocialnet/bitsocial-react-hooks';
import type { CommunityIdentifier } from '@bitsocial/bitsocial-react-hooks';
import { findDirectoryByAddress, type DirectoryCommunity, useDirectories } from './use-directories';
const isLikelyCommunityName = (value: string) => value.includes('.');
+2 -2
View File
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { Comment } from '@bitsocialnet/bitsocial-react-hooks';
import { flattenCommentsPages } from '@bitsocialnet/bitsocial-react-hooks/dist/lib/utils';
import { Comment } from '@bitsocial/bitsocial-react-hooks';
import { flattenCommentsPages } from '@bitsocial/bitsocial-react-hooks/dist/lib/utils';
const useCountLinksInReplies = (comment: Comment, firstXReplies?: number) => {
let linkCount = 0;
+1 -1
View File
@@ -1,5 +1,5 @@
import { useCallback, useMemo, useRef, useState } from 'react';
import { ChallengeVerification, Comment, PublishCommentOptions, deleteComment, usePublishComment } from '@bitsocialnet/bitsocial-react-hooks';
import { ChallengeVerification, Comment, PublishCommentOptions, deleteComment, usePublishComment } from '@bitsocial/bitsocial-react-hooks';
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
import useChallengesStore from '../stores/use-challenges-store';
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import localForageLru from '@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
import localForageLru from '@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
const gifFrameDb = localForageLru.createInstance({ name: '5chanGifFrames', size: 500 });
const failedUrls = new Set<string>();
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { Comment, useAccountComments } from '@bitsocialnet/bitsocial-react-hooks';
import { Comment, useAccountComments } from '@bitsocial/bitsocial-react-hooks';
// Keep the hook on its indexed fast path when there are no reply indices to resolve.
const EMPTY_ACCOUNT_COMMENT_LOOKUP = { commentIndices: [-1] };
+1 -1
View File
@@ -1,6 +1,6 @@
import { useCallback, useMemo } from 'react';
import { create } from 'zustand';
import localForageLru from '@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
import localForageLru from '@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
interface HideStoreState {
hiddenCids: { [key: string]: boolean };
+1 -1
View File
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
import { useEffect } from 'react';
import { Community } from '@bitsocialnet/bitsocial-react-hooks';
import { Community } from '@bitsocial/bitsocial-react-hooks';
import { getFormattedTimeAgo } from '../lib/utils/time-utils';
import useCommunityOfflineStore from '../stores/use-community-offline-store';
import useCommunitiesLoadingStartTimestamps from '../stores/use-communities-loading-start-timestamps-store';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { Comment, type Community } from '@bitsocialnet/bitsocial-react-hooks';
import { Comment, type Community } from '@bitsocial/bitsocial-react-hooks';
import { getCommentMediaInfo, getHasThumbnail } from '../lib/utils/media-utils';
import useCommunitiesLoadingStartTimestamps from '../stores/use-communities-loading-start-timestamps-store';
import { useCurrentTime } from './use-current-time';
+2 -2
View File
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { useFeed } from '@bitsocialnet/bitsocial-react-hooks';
import useFeedsStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/feeds';
import { useFeed } from '@bitsocial/bitsocial-react-hooks';
import useFeedsStore from '@bitsocial/bitsocial-react-hooks/dist/stores/feeds';
import { useDirectoryByAddress } from './use-directories';
import { useBoardFeedPageSize } from './use-board-feed-page-size';
import { useCommunityIdentifier } from './use-community-identifiers';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useAccount, useResolvedAuthorAddress } from '@bitsocialnet/bitsocial-react-hooks';
import { useAccount, useResolvedAuthorAddress } from '@bitsocial/bitsocial-react-hooks';
type PublishAuthorDomainBlockReason = 'resolving' | 'unresolved' | 'mismatch';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Comment, usePublishComment } from '@bitsocialnet/bitsocial-react-hooks';
import { Comment, usePublishComment } from '@bitsocial/bitsocial-react-hooks';
import usePublishPostStore from '../stores/use-publish-post-store';
import useChallengesStore from '../stores/use-challenges-store';
import usePublishAuthorDomainGuard, { getPublishAuthorDomainErrorMessage } from './use-publish-author-domain-guard';
+1 -1
View File
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Comment, useAccount, usePublishComment } from '@bitsocialnet/bitsocial-react-hooks';
import { Comment, useAccount, usePublishComment } from '@bitsocial/bitsocial-react-hooks';
import { useDirectories } from './use-directories';
import usePublishReplyStore from '../stores/use-publish-reply-store';
import usePostNumberStore, { getScopedNumberToCidMap } from '../stores/use-post-number-store';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useCallback, useMemo, useRef } from 'react';
import { Comment } from '@bitsocialnet/bitsocial-react-hooks';
import { Comment } from '@bitsocial/bitsocial-react-hooks';
import { QUOTE_NUMBER_REGEX } from '../lib/utils/url-utils';
import usePostNumberStore, { getScopedNumberToCidMap } from '../stores/use-post-number-store';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react';
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
import usePostNumberStore from '../stores/use-post-number-store';
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
import type { SizeFunction } from 'react-virtuoso';
import { useLocation } from 'react-router-dom';
import useWindowWidth from './use-window-width';
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useAccount, useAccountComment } from '@bitsocialnet/bitsocial-react-hooks';
import { useAccount, useAccountComment } from '@bitsocial/bitsocial-react-hooks';
type SafeAccountCommentOptions = {
accountName?: string;
+2 -2
View File
@@ -1,5 +1,5 @@
import useCommunitiesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities';
import type { Community } from '@bitsocialnet/bitsocial-react-hooks';
import useCommunitiesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities';
import type { Community } from '@bitsocial/bitsocial-react-hooks';
import { normalizeBoardAddress } from './use-directories';
type CommunityLike = Record<string, unknown> | Community | undefined;
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useClientsStates, useCommunity, useCommunitiesStates } from '@bitsocialnet/bitsocial-react-hooks';
import { useClientsStates, useCommunity, useCommunitiesStates } from '@bitsocial/bitsocial-react-hooks';
import debounce from 'lodash/debounce';
import getShortAddress from '../lib/get-short-address';
import { useCommunityIdentifiers } from './use-community-identifiers';