Merge branch 'es-toolkit' into 'main'
lodash -> es-toolkit Closes #1793 See merge request soapbox-pub/soapbox!3287
This commit is contained in:
commit
a9af5f9034
|
@ -100,6 +100,7 @@
|
||||||
"cssnano": "^6.0.0",
|
"cssnano": "^6.0.0",
|
||||||
"detect-passive-events": "^2.0.0",
|
"detect-passive-events": "^2.0.0",
|
||||||
"emoji-mart": "^5.6.0",
|
"emoji-mart": "^5.6.0",
|
||||||
|
"es-toolkit": "^1.27.0",
|
||||||
"eslint-plugin-formatjs": "^5.2.2",
|
"eslint-plugin-formatjs": "^5.2.2",
|
||||||
"exifr": "^7.1.3",
|
"exifr": "^7.1.3",
|
||||||
"graphemesplit": "^2.4.4",
|
"graphemesplit": "^2.4.4",
|
||||||
|
@ -113,7 +114,6 @@
|
||||||
"leaflet": "^1.8.0",
|
"leaflet": "^1.8.0",
|
||||||
"lexical": "^0.18.0",
|
"lexical": "^0.18.0",
|
||||||
"line-awesome": "^1.3.0",
|
"line-awesome": "^1.3.0",
|
||||||
"lodash": "^4.7.11",
|
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
"mini-css-extract-plugin": "^2.6.0",
|
||||||
"nostr-tools": "^2.3.0",
|
"nostr-tools": "^2.3.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import axios, { Canceler } from 'axios';
|
import axios, { Canceler } from 'axios';
|
||||||
|
import { throttle } from 'es-toolkit';
|
||||||
import { List as ImmutableList } from 'immutable';
|
import { List as ImmutableList } from 'immutable';
|
||||||
import throttle from 'lodash/throttle';
|
|
||||||
import { defineMessages, IntlShape } from 'react-intl';
|
import { defineMessages, IntlShape } from 'react-intl';
|
||||||
|
|
||||||
import api from 'soapbox/api/index.ts';
|
import api from 'soapbox/api/index.ts';
|
||||||
|
@ -510,7 +510,7 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, composeId,
|
||||||
toast.showAlertForError(error);
|
toast.showAlertForError(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 200, { leading: true, trailing: true });
|
}, 200, { edges: ['leading', 'trailing'] });
|
||||||
|
|
||||||
const fetchComposeSuggestionsEmojis = (dispatch: AppDispatch, composeId: string, token: string, customEmojis: CustomEmoji[]) => {
|
const fetchComposeSuggestionsEmojis = (dispatch: AppDispatch, composeId: string, token: string, customEmojis: CustomEmoji[]) => {
|
||||||
const results = emojiSearch(token.replace(':', ''), { maxResults: 10 }, customEmojis);
|
const results = emojiSearch(token.replace(':', ''), { maxResults: 10 }, customEmojis);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import mapValues from 'lodash/mapValues';
|
import { mapValues } from 'es-toolkit';
|
||||||
|
|
||||||
import { verifyCredentials } from './auth.ts';
|
import { verifyCredentials } from './auth.ts';
|
||||||
import { importFetchedAccounts } from './importer/index.ts';
|
import { importFetchedAccounts } from './importer/index.ts';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { throttle } from 'es-toolkit';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import throttle from 'lodash/throttle';
|
|
||||||
import { useState, useRef, useCallback, useEffect } from 'react';
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
||||||
|
|
||||||
import { accountSearch } from 'soapbox/actions/accounts.ts';
|
import { accountSearch } from 'soapbox/actions/accounts.ts';
|
||||||
|
@ -53,7 +53,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
|
||||||
setAccountIds(ImmutableOrderedSet(accountIds));
|
setAccountIds(ImmutableOrderedSet(accountIds));
|
||||||
})
|
})
|
||||||
.catch(noOp);
|
.catch(noOp);
|
||||||
}, 900, { leading: true, trailing: true }), [limit]);
|
}, 900, { edges: ['leading', 'trailing'] }), [limit]);
|
||||||
|
|
||||||
const handleChange: React.ChangeEventHandler<HTMLInputElement> = e => {
|
const handleChange: React.ChangeEventHandler<HTMLInputElement> = e => {
|
||||||
refreshCancelToken();
|
refreshCancelToken();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
|
|
||||||
import { fetchAccount } from 'soapbox/actions/accounts.ts';
|
import { fetchAccount } from 'soapbox/actions/accounts.ts';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import backspaceIcon from '@tabler/icons/outline/backspace.svg';
|
import backspaceIcon from '@tabler/icons/outline/backspace.svg';
|
||||||
import searchIcon from '@tabler/icons/outline/search.svg';
|
import searchIcon from '@tabler/icons/outline/search.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
import { throttle } from 'es-toolkit';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import throttle from 'lodash/throttle';
|
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ const LocationSearch: React.FC<ILocationSearch> = ({ onSelected }) => {
|
||||||
})
|
})
|
||||||
.catch(noOp);
|
.catch(noOp);
|
||||||
|
|
||||||
}, 900, { leading: true, trailing: true }), []);
|
}, 900, { edges: ['leading', 'trailing'] }), []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import arrowBarToUpIcon from '@tabler/icons/outline/arrow-bar-to-up.svg';
|
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 { useState, useEffect, useCallback } from 'react';
|
||||||
import { useIntl, MessageDescriptor } from 'react-intl';
|
import { useIntl, MessageDescriptor } from 'react-intl';
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ const ScrollTopButton: React.FC<IScrollTopButton> = ({
|
||||||
setScrolled(scrollTop > threshold);
|
setScrolled(scrollTop > threshold);
|
||||||
setScrolledTop(scrollTop <= autoloadThreshold);
|
setScrolledTop(scrollTop <= autoloadThreshold);
|
||||||
|
|
||||||
}, 150, { trailing: true }), [threshold, autoloadThreshold]);
|
}, 150, { edges: ['trailing'] }), [threshold, autoloadThreshold]);
|
||||||
|
|
||||||
/** Scroll to top and trigger `onClick`. */
|
/** Scroll to top and trigger `onClick`. */
|
||||||
const handleClick: React.MouseEventHandler = useCallback(() => {
|
const handleClick: React.MouseEventHandler = useCallback(() => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect, useRef, useMemo, useCallback, forwardRef } from 'react';
|
import { useEffect, useRef, useMemo, useCallback, forwardRef } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { Virtuoso, Components, VirtuosoProps, VirtuosoHandle, ListRange, IndexLocationWithAlign } from 'react-virtuoso';
|
import { Virtuoso, Components, VirtuosoProps, VirtuosoHandle, ListRange, IndexLocationWithAlign } from 'react-virtuoso';
|
||||||
|
@ -143,7 +143,7 @@ const ScrollableList = forwardRef<VirtuosoHandle, IScrollableList>(({
|
||||||
} else {
|
} else {
|
||||||
topOffset.current = 0;
|
topOffset.current = 0;
|
||||||
}
|
}
|
||||||
}, 150, { trailing: true }), []);
|
}, 150, { edges: ['trailing'] }), []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.addEventListener('scroll', handleScroll);
|
document.addEventListener('scroll', handleScroll);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useRef, useCallback } from 'react';
|
import { useRef, useCallback } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ const StatusList: React.FC<IStatusList> = ({
|
||||||
if (onLoadMore && maxId) {
|
if (onLoadMore && maxId) {
|
||||||
onLoadMore(maxId.replace('末suggestions-', ''));
|
onLoadMore(maxId.replace('末suggestions-', ''));
|
||||||
}
|
}
|
||||||
}, 300, { leading: true }), [onLoadMore, lastStatusId, statusIds.last()]);
|
}, 300, { edges: ['leading'] }), [onLoadMore, lastStatusId, statusIds.last()]);
|
||||||
|
|
||||||
const selectChild = (index: number) => {
|
const selectChild = (index: number) => {
|
||||||
node.current?.scrollIntoView({
|
node.current?.scrollIntoView({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import throttle from 'lodash/throttle';
|
import { throttle } from 'es-toolkit';
|
||||||
import { forwardRef, useCallback, useEffect, useState } from 'react';
|
import { forwardRef, useCallback, useEffect, useState } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import throttle from 'lodash/throttle';
|
import { throttle } from 'es-toolkit';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
|
|
||||||
type Point = { x: number; y: number };
|
type Point = { x: number; y: number };
|
||||||
|
|
|
@ -4,8 +4,7 @@ import playerPlayIcon from '@tabler/icons/outline/player-play.svg';
|
||||||
import volume3Icon from '@tabler/icons/outline/volume-3.svg';
|
import volume3Icon from '@tabler/icons/outline/volume-3.svg';
|
||||||
import volumeIcon from '@tabler/icons/outline/volume.svg';
|
import volumeIcon from '@tabler/icons/outline/volume.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce, throttle } from 'es-toolkit';
|
||||||
import throttle from 'lodash/throttle';
|
|
||||||
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -126,9 +125,7 @@ const Audio: React.FC<IAudio> = (props) => {
|
||||||
if (player.current) {
|
if (player.current) {
|
||||||
_setDimensions();
|
_setDimensions();
|
||||||
}
|
}
|
||||||
}, 250, {
|
}, 250, { edges: ['trailing'] });
|
||||||
trailing: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const handlePlay = () => {
|
const handlePlay = () => {
|
||||||
setPaused(false);
|
setPaused(false);
|
||||||
|
@ -263,7 +260,7 @@ const Audio: React.FC<IAudio> = (props) => {
|
||||||
|
|
||||||
setPaused(true);
|
setPaused(true);
|
||||||
}
|
}
|
||||||
}, 150, { trailing: true });
|
}, 150, { edges: ['trailing'] });
|
||||||
|
|
||||||
const handleMouseEnter = () => {
|
const handleMouseEnter = () => {
|
||||||
setHovered(true);
|
setHovered(true);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import atIcon from '@tabler/icons/outline/at.svg';
|
import atIcon from '@tabler/icons/outline/at.svg';
|
||||||
import checkIcon from '@tabler/icons/outline/check.svg';
|
import checkIcon from '@tabler/icons/outline/check.svg';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useState, useRef, useCallback } from 'react';
|
import { useState, useRef, useCallback } from 'react';
|
||||||
import { useIntl, FormattedMessage, defineMessages } from 'react-intl';
|
import { useIntl, FormattedMessage, defineMessages } from 'react-intl';
|
||||||
import { Link, useHistory } from 'react-router-dom';
|
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 = () => {
|
const onSubmit: React.FormEventHandler = () => {
|
||||||
if (!passwordsMatch()) {
|
if (!passwordsMatch()) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const handleLoadMore = debounce((dispatch) => {
|
const handleLoadMore = debounce((dispatch) => {
|
||||||
dispatch(expandBookmarkedStatuses());
|
dispatch(expandBookmarkedStatuses());
|
||||||
}, 300, { leading: true });
|
}, 300, { edges: ['leading'] });
|
||||||
|
|
||||||
interface IBookmarks {
|
interface IBookmarks {
|
||||||
params?: {
|
params?: {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import moodSmileIcon from '@tabler/icons/outline/mood-smile.svg';
|
||||||
import trashIcon from '@tabler/icons/outline/trash.svg';
|
import trashIcon from '@tabler/icons/outline/trash.svg';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import escape from 'lodash/escape';
|
import { escape } from 'es-toolkit';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import xIcon from '@tabler/icons/outline/x.svg';
|
import xIcon from '@tabler/icons/outline/x.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import searchIcon from '@tabler/icons/outline/search.svg';
|
import searchIcon from '@tabler/icons/outline/search.svg';
|
||||||
import xIcon from '@tabler/icons/outline/x.svg';
|
import xIcon from '@tabler/icons/outline/x.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ const ConversationsList: React.FC = () => {
|
||||||
const handleLoadOlder = debounce(() => {
|
const handleLoadOlder = debounce(() => {
|
||||||
const maxId = conversations.getIn([-1, 'id']);
|
const maxId = conversations.getIn([-1, 'id']);
|
||||||
if (maxId) dispatch(expandConversations({ maxId }));
|
if (maxId) dispatch(expandConversations({ maxId }));
|
||||||
}, 300, { leading: true });
|
}, 300, { edges: ['leading'] });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollableList
|
<ScrollableList
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const handleLoadMore = debounce((dispatch) => {
|
const handleLoadMore = debounce((dispatch) => {
|
||||||
dispatch(expandDomainBlocks());
|
dispatch(expandDomainBlocks());
|
||||||
}, 300, { leading: true });
|
}, 300, { edges: ['leading'] });
|
||||||
|
|
||||||
const DomainBlocks: React.FC = () => {
|
const DomainBlocks: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ const EventDiscussion: React.FC<IEventDiscussion> = (props) => {
|
||||||
setNext(next);
|
setNext(next);
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
}, 300, { leading: true }), [next, status]);
|
}, 300, { edges: ['leading'] }), [next, status]);
|
||||||
|
|
||||||
const hasDescendants = descendantsIds.size > 0;
|
const hasDescendants = descendantsIds.size > 0;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ const Favourites: React.FC<IFavourites> = ({ params }) => {
|
||||||
} else if (account) {
|
} else if (account) {
|
||||||
dispatch(expandAccountFavouritedStatuses(account.id));
|
dispatch(expandAccountFavouritedStatuses(account.id));
|
||||||
}
|
}
|
||||||
}, 300, { leading: true }), [account?.id]);
|
}, 300, { edges: ['leading'] }), [account?.id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOwnAccount)
|
if (isOwnAccount)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const handleLoadMore = debounce((dispatch) => {
|
const handleLoadMore = debounce((dispatch) => {
|
||||||
dispatch(expandFollowRequests());
|
dispatch(expandFollowRequests());
|
||||||
}, 300, { leading: true });
|
}, 300, { edges: ['leading'] });
|
||||||
|
|
||||||
const FollowRequests: React.FC = () => {
|
const FollowRequests: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const handleLoadMore = debounce((dispatch) => {
|
const handleLoadMore = debounce((dispatch) => {
|
||||||
dispatch(expandFollowedHashtags());
|
dispatch(expandFollowedHashtags());
|
||||||
}, 300, { leading: true });
|
}, 300, { edges: ['leading'] });
|
||||||
|
|
||||||
const FollowedTags = () => {
|
const FollowedTags = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { NSet, NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
import { NSet, NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
||||||
import isEqual from 'lodash/isEqual';
|
import { isEqual } from 'es-toolkit';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { useNostr } from 'soapbox/contexts/nostr-context.tsx';
|
import { useNostr } from 'soapbox/contexts/nostr-context.tsx';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import get from 'lodash/get';
|
import { get } from 'es-toolkit/compat';
|
||||||
|
|
||||||
import Toggle from 'soapbox/components/ui/toggle.tsx';
|
import Toggle from 'soapbox/components/ui/toggle.tsx';
|
||||||
import { Settings } from 'soapbox/schemas/soapbox/settings.ts';
|
import { Settings } from 'soapbox/schemas/soapbox/settings.ts';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
@ -77,7 +77,7 @@ const Notifications = () => {
|
||||||
const handleLoadOlder = useCallback(debounce(() => {
|
const handleLoadOlder = useCallback(debounce(() => {
|
||||||
const last = notifications.last();
|
const last = notifications.last();
|
||||||
dispatch(expandNotifications({ maxId: last && last.get('id') }));
|
dispatch(expandNotifications({ maxId: last && last.get('id') }));
|
||||||
}, 300, { leading: true }), [notifications]);
|
}, 300, { edges: ['leading'] }), [notifications]);
|
||||||
|
|
||||||
const handleScrollToTop = useCallback(debounce(() => {
|
const handleScrollToTop = useCallback(debounce(() => {
|
||||||
dispatch(scrollTopNotifications(true));
|
dispatch(scrollTopNotifications(true));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
@ -17,7 +17,7 @@ const messages = defineMessages({
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleLoadMore = debounce((statusId: string, dispatch: React.Dispatch<any>) =>
|
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 Quotes: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const handleLoadMore = debounce((dispatch) => {
|
const handleLoadMore = debounce((dispatch) => {
|
||||||
dispatch(expandScheduledStatuses());
|
dispatch(expandScheduledStatuses());
|
||||||
}, 300, { leading: true });
|
}, 300, { edges: ['leading'] });
|
||||||
|
|
||||||
const ScheduledStatuses = () => {
|
const ScheduledStatuses = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
|
@ -82,7 +82,7 @@ const StatusDetails: React.FC<IStatusDetails> = (props) => {
|
||||||
setNext(next);
|
setNext(next);
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
}
|
}
|
||||||
}, 300, { leading: true }), [next, status]);
|
}, 300, { edges: ['leading'] }), [next, status]);
|
||||||
|
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
return fetchData();
|
return fetchData();
|
||||||
|
|
|
@ -141,7 +141,7 @@ class ImageLoader extends PureComponent<IImageLoader> {
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<canvas
|
<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={{
|
style={{
|
||||||
background: 'url(\'../assets/images/void.png\') repeat',
|
background: 'url(\'../assets/images/void.png\') repeat',
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import arrowsMinimizeIcon from '@tabler/icons/outline/arrows-minimize.svg';
|
||||||
import downloadIcon from '@tabler/icons/outline/download.svg';
|
import downloadIcon from '@tabler/icons/outline/download.svg';
|
||||||
import xIcon from '@tabler/icons/outline/x.svg';
|
import xIcon from '@tabler/icons/outline/x.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
@ -201,7 +201,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
||||||
setNext(next);
|
setNext(next);
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
}
|
}
|
||||||
}, 300, { leading: true }), [next, status]);
|
}, 300, { edges: ['leading'] }), [next, status]);
|
||||||
|
|
||||||
/** Fetch the status (and context) from the API. */
|
/** Fetch the status (and context) from the API. */
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import xIcon from '@tabler/icons/outline/x.svg';
|
import xIcon from '@tabler/icons/outline/x.svg';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import ScrollableList from 'soapbox/components/scrollable-list.tsx';
|
import ScrollableList from 'soapbox/components/scrollable-list.tsx';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce } from 'es-toolkit';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { useFloating } from '@floating-ui/react';
|
||||||
import logoutIcon from '@tabler/icons/outline/logout.svg';
|
import logoutIcon from '@tabler/icons/outline/logout.svg';
|
||||||
import plusIcon from '@tabler/icons/outline/plus.svg';
|
import plusIcon from '@tabler/icons/outline/plus.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import throttle from 'lodash/throttle';
|
import { throttle } from 'es-toolkit';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { debounce } from 'es-toolkit';
|
||||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import debounce from 'lodash/debounce';
|
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,7 @@ import playerPlayIcon from '@tabler/icons/outline/player-play.svg';
|
||||||
import volume3Icon from '@tabler/icons/outline/volume-3.svg';
|
import volume3Icon from '@tabler/icons/outline/volume-3.svg';
|
||||||
import volumeIcon from '@tabler/icons/outline/volume.svg';
|
import volumeIcon from '@tabler/icons/outline/volume.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import debounce from 'lodash/debounce';
|
import { debounce, throttle } from 'es-toolkit';
|
||||||
import throttle from 'lodash/throttle';
|
|
||||||
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -376,7 +375,7 @@ const Video: React.FC<IVideo> = ({
|
||||||
const handleResize = useCallback(debounce(() => {
|
const handleResize = useCallback(debounce(() => {
|
||||||
setDimensions();
|
setDimensions();
|
||||||
}, 250, {
|
}, 250, {
|
||||||
trailing: true,
|
edges: ['trailing'],
|
||||||
}), [player.current, cacheWidth]);
|
}), [player.current, cacheWidth]);
|
||||||
|
|
||||||
const handleScroll = useCallback(throttle(() => {
|
const handleScroll = useCallback(throttle(() => {
|
||||||
|
@ -389,7 +388,7 @@ const Video: React.FC<IVideo> = ({
|
||||||
setPaused(true);
|
setPaused(true);
|
||||||
video.current.pause();
|
video.current.pause();
|
||||||
}
|
}
|
||||||
}, 150, { trailing: true }), [video.current, paused]);
|
}, 150, { edges: ['trailing'] }), [video.current, paused]);
|
||||||
|
|
||||||
const handleFullscreenChange = useCallback(() => {
|
const handleFullscreenChange = useCallback(() => {
|
||||||
setFullscreen(isFullscreen());
|
setFullscreen(isFullscreen());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { get } from 'es-toolkit/compat';
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
import get from 'lodash/get';
|
|
||||||
|
|
||||||
import { type Relationship, relationshipSchema } from 'soapbox/schemas/index.ts';
|
import { type Relationship, relationshipSchema } from 'soapbox/schemas/index.ts';
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { sample } from 'es-toolkit';
|
||||||
import {
|
import {
|
||||||
Map as ImmutableMap,
|
Map as ImmutableMap,
|
||||||
List as ImmutableList,
|
List as ImmutableList,
|
||||||
|
@ -5,7 +6,6 @@ import {
|
||||||
Record as ImmutableRecord,
|
Record as ImmutableRecord,
|
||||||
fromJS,
|
fromJS,
|
||||||
} from 'immutable';
|
} from 'immutable';
|
||||||
import sample from 'lodash/sample';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ACCOUNT_BLOCK_SUCCESS,
|
ACCOUNT_BLOCK_SUCCESS,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/// <reference lib="webworker" />
|
/// <reference lib="webworker" />
|
||||||
|
import { unescape } from 'es-toolkit';
|
||||||
import IntlMessageFormat from 'intl-messageformat';
|
import IntlMessageFormat from 'intl-messageformat';
|
||||||
import 'intl-pluralrules';
|
import 'intl-pluralrules';
|
||||||
import unescape from 'lodash/unescape';
|
|
||||||
|
|
||||||
import expandIcon from '../assets/images/web-push/web-push-icon_expand.png';
|
import expandIcon from '../assets/images/web-push/web-push-icon_expand.png';
|
||||||
import favouriteIcon from '../assets/images/web-push/web-push-icon_favourite.png';
|
import favouriteIcon from '../assets/images/web-push/web-push-icon_favourite.png';
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import camelCase from 'lodash/camelCase';
|
import { camelCase, startCase } from 'es-toolkit';
|
||||||
import startCase from 'lodash/startCase';
|
|
||||||
|
|
||||||
const toSentence = (arr: string[]) => arr
|
const toSentence = (arr: string[]) => arr
|
||||||
.reduce(
|
.reduce(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { default as lodashGet } from 'lodash/get';
|
import { get as _get } from 'es-toolkit/compat';
|
||||||
|
|
||||||
interface LegacyMap {
|
interface LegacyMap {
|
||||||
get(key: any): unknown;
|
get(key: any): unknown;
|
||||||
|
@ -22,7 +22,7 @@ function immutableizeEntity<T extends Record<any, any>>(entity: T): T & LegacyMa
|
||||||
},
|
},
|
||||||
|
|
||||||
getIn(keyPath: any[]): unknown {
|
getIn(keyPath: any[]): unknown {
|
||||||
return lodashGet(entity, keyPath);
|
return _get(entity, keyPath);
|
||||||
},
|
},
|
||||||
|
|
||||||
toJS() {
|
toJS() {
|
||||||
|
@ -41,7 +41,7 @@ function immutableizeStore<T, S extends Record<string, T | undefined>>(state: S)
|
||||||
},
|
},
|
||||||
|
|
||||||
getIn(keyPath: any[]): unknown {
|
getIn(keyPath: any[]): unknown {
|
||||||
return lodashGet(state, keyPath);
|
return _get(state, keyPath);
|
||||||
},
|
},
|
||||||
|
|
||||||
find(predicate: (value: T & LegacyMap, key: string) => boolean): T & LegacyMap | undefined {
|
find(predicate: (value: T & LegacyMap, key: string) => boolean): T & LegacyMap | undefined {
|
||||||
|
|
|
@ -4325,6 +4325,11 @@ es-to-primitive@^1.2.1:
|
||||||
is-date-object "^1.0.1"
|
is-date-object "^1.0.1"
|
||||||
is-symbol "^1.0.2"
|
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:
|
esbuild@^0.19.1:
|
||||||
version "0.19.10"
|
version "0.19.10"
|
||||||
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.10.tgz#55e83e4a6b702e3498b9f872d84bfb4ebcb6d16e"
|
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"
|
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||||
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
|
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"
|
version "4.17.21"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||||
|
|
Loading…
Reference in New Issue