Merge branch 'main' into remove-fragments-of-bookmark-folders

This commit is contained in:
P. Reis 2024-11-28 14:33:19 -03:00
commit 7573a34359
44 changed files with 74 additions and 74 deletions

View File

@ -100,6 +100,7 @@
"cssnano": "^6.0.0",
"detect-passive-events": "^2.0.0",
"emoji-mart": "^5.6.0",
"es-toolkit": "^1.27.0",
"eslint-plugin-formatjs": "^5.2.2",
"exifr": "^7.1.3",
"graphemesplit": "^2.4.4",
@ -113,7 +114,6 @@
"leaflet": "^1.8.0",
"lexical": "^0.18.0",
"line-awesome": "^1.3.0",
"lodash": "^4.7.11",
"mini-css-extract-plugin": "^2.6.0",
"nostr-tools": "^2.3.0",
"path-browserify": "^1.0.1",

View File

@ -1,6 +1,6 @@
import axios, { Canceler } from 'axios';
import { throttle } from 'es-toolkit';
import { List as ImmutableList } from 'immutable';
import throttle from 'lodash/throttle';
import { defineMessages, IntlShape } from 'react-intl';
import api from 'soapbox/api/index.ts';
@ -510,7 +510,7 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, composeId,
toast.showAlertForError(error);
}
});
}, 200, { leading: true, trailing: true });
}, 200, { edges: ['leading', 'trailing'] });
const fetchComposeSuggestionsEmojis = (dispatch: AppDispatch, composeId: string, token: string, customEmojis: CustomEmoji[]) => {
const results = emojiSearch(token.replace(':', ''), { maxResults: 10 }, customEmojis);

View File

@ -1,4 +1,4 @@
import mapValues from 'lodash/mapValues';
import { mapValues } from 'es-toolkit';
import { verifyCredentials } from './auth.ts';
import { importFetchedAccounts } from './importer/index.ts';

View File

@ -1,5 +1,5 @@
import { throttle } from 'es-toolkit';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import throttle from 'lodash/throttle';
import { useState, useRef, useCallback, useEffect } from 'react';
import { accountSearch } from 'soapbox/actions/accounts.ts';
@ -53,7 +53,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
setAccountIds(ImmutableOrderedSet(accountIds));
})
.catch(noOp);
}, 900, { leading: true, trailing: true }), [limit]);
}, 900, { edges: ['leading', 'trailing'] }), [limit]);
const handleChange: React.ChangeEventHandler<HTMLInputElement> = e => {
refreshCancelToken();

View File

@ -1,5 +1,5 @@
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useRef } from 'react';
import { fetchAccount } from 'soapbox/actions/accounts.ts';

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useRef } from 'react';
import { useDispatch } from 'react-redux';

View File

@ -1,8 +1,8 @@
import backspaceIcon from '@tabler/icons/outline/backspace.svg';
import searchIcon from '@tabler/icons/outline/search.svg';
import clsx from 'clsx';
import { throttle } from 'es-toolkit';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import throttle from 'lodash/throttle';
import { useCallback, useEffect, useRef, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
@ -78,7 +78,7 @@ const LocationSearch: React.FC<ILocationSearch> = ({ onSelected }) => {
})
.catch(noOp);
}, 900, { leading: true, trailing: true }), []);
}, 900, { edges: ['leading', 'trailing'] }), []);
useEffect(() => {
if (value === '') {

View File

@ -1,5 +1,5 @@
import arrowBarToUpIcon from '@tabler/icons/outline/arrow-bar-to-up.svg';
import throttle from 'lodash/throttle';
import { throttle } from 'es-toolkit';
import { useState, useEffect, useCallback } from 'react';
import { useIntl, MessageDescriptor } from 'react-intl';
@ -57,7 +57,7 @@ const ScrollTopButton: React.FC<IScrollTopButton> = ({
setScrolled(scrollTop > threshold);
setScrolledTop(scrollTop <= autoloadThreshold);
}, 150, { trailing: true }), [threshold, autoloadThreshold]);
}, 150, { edges: ['trailing'] }), [threshold, autoloadThreshold]);
/** Scroll to top and trigger `onClick`. */
const handleClick: React.MouseEventHandler = useCallback(() => {

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect, useRef, useMemo, useCallback, forwardRef } from 'react';
import { useHistory } from 'react-router-dom';
import { Virtuoso, Components, VirtuosoProps, VirtuosoHandle, ListRange, IndexLocationWithAlign } from 'react-virtuoso';
@ -143,7 +143,7 @@ const ScrollableList = forwardRef<VirtuosoHandle, IScrollableList>(({
} else {
topOffset.current = 0;
}
}, 150, { trailing: true }), []);
}, 150, { edges: ['trailing'] }), []);
useEffect(() => {
document.addEventListener('scroll', handleScroll);

View File

@ -1,5 +1,5 @@
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useRef, useCallback } from 'react';
import { FormattedMessage } from 'react-intl';
@ -89,7 +89,7 @@ const StatusList: React.FC<IStatusList> = ({
if (onLoadMore && maxId) {
onLoadMore(maxId.replace('末suggestions-', ''));
}
}, 300, { leading: true }), [onLoadMore, lastStatusId, statusIds.last()]);
}, 300, { edges: ['leading'] }), [onLoadMore, lastStatusId, statusIds.last()]);
const selectChild = (index: number) => {
node.current?.scrollIntoView({

View File

@ -1,5 +1,5 @@
import clsx from 'clsx';
import throttle from 'lodash/throttle';
import { throttle } from 'es-toolkit';
import { forwardRef, useCallback, useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';

View File

@ -1,4 +1,4 @@
import throttle from 'lodash/throttle';
import { throttle } from 'es-toolkit';
import { useRef } from 'react';
type Point = { x: number; y: number };

View File

@ -4,8 +4,7 @@ import playerPlayIcon from '@tabler/icons/outline/player-play.svg';
import volume3Icon from '@tabler/icons/outline/volume-3.svg';
import volumeIcon from '@tabler/icons/outline/volume.svg';
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle';
import { debounce, throttle } from 'es-toolkit';
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
@ -126,9 +125,7 @@ const Audio: React.FC<IAudio> = (props) => {
if (player.current) {
_setDimensions();
}
}, 250, {
trailing: true,
});
}, 250, { edges: ['trailing'] });
const handlePlay = () => {
setPaused(false);
@ -263,7 +260,7 @@ const Audio: React.FC<IAudio> = (props) => {
setPaused(true);
}
}, 150, { trailing: true });
}, 150, { edges: ['trailing'] });
const handleMouseEnter = () => {
setHovered(true);

View File

@ -1,8 +1,8 @@
import atIcon from '@tabler/icons/outline/at.svg';
import checkIcon from '@tabler/icons/outline/check.svg';
import axios from 'axios';
import { debounce } from 'es-toolkit';
import { Map as ImmutableMap } from 'immutable';
import debounce from 'lodash/debounce';
import { useState, useRef, useCallback } from 'react';
import { useIntl, FormattedMessage, defineMessages } from 'react-intl';
import { Link, useHistory } from 'react-router-dom';
@ -200,7 +200,7 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
}
});
}, 1000, { trailing: true }), []);
}, 1000, { edges: ['trailing'] }), []);
const onSubmit: React.FormEventHandler = () => {
if (!passwordsMatch()) {

View File

@ -1,5 +1,5 @@
import { debounce } from 'es-toolkit';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import debounce from 'lodash/debounce';
import { useEffect } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
@ -18,7 +18,7 @@ const messages = defineMessages({
const handleLoadMore = debounce((dispatch) => {
dispatch(expandBookmarkedStatuses());
}, 300, { leading: true });
}, 300, { edges: ['leading'] });
interface IBookmarks {
params?: {

View File

@ -6,7 +6,7 @@ import moodSmileIcon from '@tabler/icons/outline/mood-smile.svg';
import trashIcon from '@tabler/icons/outline/trash.svg';
import { useMutation } from '@tanstack/react-query';
import clsx from 'clsx';
import escape from 'lodash/escape';
import { escape } from 'es-toolkit';
import { useMemo, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';

View File

@ -1,6 +1,6 @@
import xIcon from '@tabler/icons/outline/x.svg';
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useCallback, useEffect } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom';

View File

@ -1,7 +1,7 @@
import searchIcon from '@tabler/icons/outline/search.svg';
import xIcon from '@tabler/icons/outline/x.svg';
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useCallback, useEffect } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom';

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useRef } from 'react';
import { FormattedMessage } from 'react-intl';
@ -48,7 +48,7 @@ const ConversationsList: React.FC = () => {
const handleLoadOlder = debounce(() => {
const maxId = conversations.getIn([-1, 'id']);
if (maxId) dispatch(expandConversations({ maxId }));
}, 300, { leading: true });
}, 300, { edges: ['leading'] });
return (
<ScrollableList

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect } from 'react';
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
@ -17,7 +17,7 @@ const messages = defineMessages({
const handleLoadMore = debounce((dispatch) => {
dispatch(expandDomainBlocks());
}, 300, { leading: true });
}, 300, { edges: ['leading'] });
const DomainBlocks: React.FC = () => {
const dispatch = useAppDispatch();

View File

@ -1,5 +1,5 @@
import { debounce } from 'es-toolkit';
import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
import debounce from 'lodash/debounce';
import { useCallback, useEffect, useRef, useState } from 'react';
import { FormattedMessage } from 'react-intl';
@ -154,7 +154,7 @@ const EventDiscussion: React.FC<IEventDiscussion> = (props) => {
setNext(next);
}).catch(() => {});
}
}, 300, { leading: true }), [next, status]);
}, 300, { edges: ['leading'] }), [next, status]);
const hasDescendants = descendantsIds.size > 0;

View File

@ -1,5 +1,5 @@
import { debounce } from 'es-toolkit';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import debounce from 'lodash/debounce';
import { useCallback, useEffect } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
@ -44,7 +44,7 @@ const Favourites: React.FC<IFavourites> = ({ params }) => {
} else if (account) {
dispatch(expandAccountFavouritedStatuses(account.id));
}
}, 300, { leading: true }), [account?.id]);
}, 300, { edges: ['leading'] }), [account?.id]);
useEffect(() => {
if (isOwnAccount)

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect } from 'react';
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
@ -17,7 +17,7 @@ const messages = defineMessages({
const handleLoadMore = debounce((dispatch) => {
dispatch(expandFollowRequests());
}, 300, { leading: true });
}, 300, { edges: ['leading'] });
const FollowRequests: React.FC = () => {
const dispatch = useAppDispatch();

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect } from 'react';
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
@ -16,7 +16,7 @@ const messages = defineMessages({
const handleLoadMore = debounce((dispatch) => {
dispatch(expandFollowedHashtags());
}, 300, { leading: true });
}, 300, { edges: ['leading'] });
const FollowedTags = () => {
const intl = useIntl();

View File

@ -1,5 +1,5 @@
import { NSet, NostrEvent, NostrFilter } from '@nostrify/nostrify';
import isEqual from 'lodash/isEqual';
import { isEqual } from 'es-toolkit';
import { useEffect, useRef, useState } from 'react';
import { useNostr } from 'soapbox/contexts/nostr-context.tsx';

View File

@ -1,4 +1,4 @@
import get from 'lodash/get';
import { get } from 'es-toolkit/compat';
import Toggle from 'soapbox/components/ui/toggle.tsx';
import { Settings } from 'soapbox/schemas/soapbox/settings.ts';

View File

@ -1,6 +1,6 @@
import clsx from 'clsx';
import { debounce } from 'es-toolkit';
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
import debounce from 'lodash/debounce';
import { useCallback, useEffect, useRef } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { createSelector } from 'reselect';
@ -77,7 +77,7 @@ const Notifications = () => {
const handleLoadOlder = useCallback(debounce(() => {
const last = notifications.last();
dispatch(expandNotifications({ maxId: last && last.get('id') }));
}, 300, { leading: true }), [notifications]);
}, 300, { edges: ['leading'] }), [notifications]);
const handleScrollToTop = useCallback(debounce(() => {
dispatch(scrollTopNotifications(true));

View File

@ -1,5 +1,5 @@
import { debounce } from 'es-toolkit';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import debounce from 'lodash/debounce';
import { useEffect } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useParams } from 'react-router-dom';
@ -17,7 +17,7 @@ const messages = defineMessages({
});
const handleLoadMore = debounce((statusId: string, dispatch: React.Dispatch<any>) =>
dispatch(expandStatusQuotes(statusId)), 300, { leading: true });
dispatch(expandStatusQuotes(statusId)), 300, { edges: ['leading'] });
const Quotes: React.FC = () => {
const dispatch = useAppDispatch();

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect } from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
@ -16,7 +16,7 @@ const messages = defineMessages({
const handleLoadMore = debounce((dispatch) => {
dispatch(expandScheduledStatuses());
}, 300, { leading: true });
}, 300, { edges: ['leading'] });
const ScheduledStatuses = () => {
const intl = useIntl();

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useCallback, useEffect, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { Redirect } from 'react-router-dom';
@ -82,7 +82,7 @@ const StatusDetails: React.FC<IStatusDetails> = (props) => {
setNext(next);
}).catch(() => { });
}
}, 300, { leading: true }), [next, status]);
}, 300, { edges: ['leading'] }), [next, status]);
const handleRefresh = () => {
return fetchData();

View File

@ -141,7 +141,7 @@ class ImageLoader extends PureComponent<IImageLoader> {
<div className={className}>
{loading ? (
<canvas
className={clsx('max-h-[100%] max-w-full object-contain', { 'hidden': !this.hasSize() })}
className={clsx('max-h-full max-w-full object-contain', { 'hidden': !this.hasSize() })}
style={{
background: 'url(\'../assets/images/void.png\') repeat',
}}

View File

@ -5,7 +5,7 @@ import arrowsMinimizeIcon from '@tabler/icons/outline/arrows-minimize.svg';
import downloadIcon from '@tabler/icons/outline/download.svg';
import xIcon from '@tabler/icons/outline/x.svg';
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useCallback, useEffect, useState } from 'react';
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
import { useHistory } from 'react-router-dom';
@ -201,7 +201,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
setNext(next);
}).catch(() => { });
}
}, 300, { leading: true }), [next, status]);
}, 300, { edges: ['leading'] }), [next, status]);
/** Fetch the status (and context) from the API. */
const fetchData = async () => {

View File

@ -1,5 +1,5 @@
import xIcon from '@tabler/icons/outline/x.svg';
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { FormattedMessage } from 'react-intl';
import ScrollableList from 'soapbox/components/scrollable-list.tsx';

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'es-toolkit';
import { useEffect, useRef, useState } from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';

View File

@ -2,7 +2,7 @@ import { useFloating } from '@floating-ui/react';
import logoutIcon from '@tabler/icons/outline/logout.svg';
import plusIcon from '@tabler/icons/outline/plus.svg';
import clsx from 'clsx';
import throttle from 'lodash/throttle';
import { throttle } from 'es-toolkit';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { Link } from 'react-router-dom';

View File

@ -1,5 +1,5 @@
import { debounce } from 'es-toolkit';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import debounce from 'lodash/debounce';
import { useCallback } from 'react';
import { defineMessages } from 'react-intl';

View File

@ -5,8 +5,7 @@ import playerPlayIcon from '@tabler/icons/outline/player-play.svg';
import volume3Icon from '@tabler/icons/outline/volume-3.svg';
import volumeIcon from '@tabler/icons/outline/volume.svg';
import clsx from 'clsx';
import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle';
import { debounce, throttle } from 'es-toolkit';
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
@ -376,7 +375,7 @@ const Video: React.FC<IVideo> = ({
const handleResize = useCallback(debounce(() => {
setDimensions();
}, 250, {
trailing: true,
edges: ['trailing'],
}), [player.current, cacheWidth]);
const handleScroll = useCallback(throttle(() => {
@ -389,7 +388,7 @@ const Video: React.FC<IVideo> = ({
setPaused(true);
video.current.pause();
}
}, 150, { trailing: true }), [video.current, paused]);
}, 150, { edges: ['trailing'] }), [video.current, paused]);
const handleFullscreenChange = useCallback(() => {
setFullscreen(isFullscreen());

View File

@ -1,5 +1,5 @@
import { get } from 'es-toolkit/compat';
import { Map as ImmutableMap } from 'immutable';
import get from 'lodash/get';
import { type Relationship, relationshipSchema } from 'soapbox/schemas/index.ts';

View File

@ -1,3 +1,4 @@
import { sample } from 'es-toolkit';
import {
Map as ImmutableMap,
List as ImmutableList,
@ -5,7 +6,6 @@ import {
Record as ImmutableRecord,
fromJS,
} from 'immutable';
import sample from 'lodash/sample';
import {
ACCOUNT_BLOCK_SUCCESS,

View File

@ -1,7 +1,7 @@
/// <reference lib="webworker" />
import { unescape } from 'es-toolkit';
import IntlMessageFormat from 'intl-messageformat';
import 'intl-pluralrules';
import unescape from 'lodash/unescape';
import expandIcon from '../assets/images/web-push/web-push-icon_expand.png';
import favouriteIcon from '../assets/images/web-push/web-push-icon_favourite.png';

View File

@ -1,5 +1,4 @@
import camelCase from 'lodash/camelCase';
import startCase from 'lodash/startCase';
import { camelCase, startCase } from 'es-toolkit';
const toSentence = (arr: string[]) => arr
.reduce(

View File

@ -1,4 +1,4 @@
import { default as lodashGet } from 'lodash/get';
import { get as _get } from 'es-toolkit/compat';
interface LegacyMap {
get(key: any): unknown;
@ -22,7 +22,7 @@ function immutableizeEntity<T extends Record<any, any>>(entity: T): T & LegacyMa
},
getIn(keyPath: any[]): unknown {
return lodashGet(entity, keyPath);
return _get(entity, keyPath);
},
toJS() {
@ -41,7 +41,7 @@ function immutableizeStore<T, S extends Record<string, T | undefined>>(state: S)
},
getIn(keyPath: any[]): unknown {
return lodashGet(state, keyPath);
return _get(state, keyPath);
},
find(predicate: (value: T & LegacyMap, key: string) => boolean): T & LegacyMap | undefined {

View File

@ -4325,6 +4325,11 @@ es-to-primitive@^1.2.1:
is-date-object "^1.0.1"
is-symbol "^1.0.2"
es-toolkit@^1.27.0:
version "1.27.0"
resolved "https://registry.yarnpkg.com/es-toolkit/-/es-toolkit-1.27.0.tgz#affc1aaf78d47e42d282c427c14bf8b610923f12"
integrity sha512-ETSFA+ZJArcuSCpzD2TjAy6UHpx4E4uqFsoDg9F/nTLogrLmVVZQ+zNxco5h7cWnA1nNak07IXsLcaSMih+ZPQ==
esbuild@^0.19.1:
version "0.19.10"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.10.tgz#55e83e4a6b702e3498b9f872d84bfb4ebcb6d16e"
@ -5989,7 +5994,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@^4.0.1, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.11:
lodash@^4.0.1, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==