replace lodash.chunk with @atproto/common-web util
This commit is contained in:
@@ -171,7 +171,6 @@
|
||||
"jwt-decode": "^4.0.0",
|
||||
"lande": "^1.0.10",
|
||||
"libphonenumber-js": "^1.12.31",
|
||||
"lodash.chunk": "^4.2.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"lodash.shuffle": "^4.2.0",
|
||||
@@ -239,7 +238,6 @@
|
||||
"@testing-library/jest-native": "^5.4.3",
|
||||
"@testing-library/react-native": "^13.2.0",
|
||||
"@types/jest": "29.5.14",
|
||||
"@types/lodash.chunk": "^4.2.7",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/lodash.isequal": "^4.5.6",
|
||||
"@types/lodash.shuffle": "^4.2.7",
|
||||
|
||||
@@ -5,8 +5,7 @@ import {
|
||||
type BskyAgent,
|
||||
type ComAtprotoRepoApplyWrites,
|
||||
} from '@atproto/api'
|
||||
import {TID} from '@atproto/common-web'
|
||||
import chunk from 'lodash.chunk'
|
||||
import {chunkArray, TID} from '@atproto/common-web'
|
||||
|
||||
import {until} from '#/lib/async/until'
|
||||
|
||||
@@ -33,7 +32,7 @@ export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) {
|
||||
value: r,
|
||||
}))
|
||||
|
||||
const chunks = chunk(followWrites, 50)
|
||||
const chunks = chunkArray(followWrites, 50)
|
||||
for (const chunk of chunks) {
|
||||
await agent.com.atproto.repo.applyWrites({
|
||||
repo: session.did,
|
||||
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
type Facet,
|
||||
type Un$Typed,
|
||||
} from '@atproto/api'
|
||||
import {chunkArray} from '@atproto/common-web'
|
||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||
import chunk from 'lodash.chunk'
|
||||
|
||||
import {uploadBlob} from '#/lib/api'
|
||||
import {until} from '#/lib/async/until'
|
||||
@@ -230,7 +230,7 @@ export function useListDeleteMutation() {
|
||||
.concat([createDel(uri)])
|
||||
|
||||
// apply in chunks
|
||||
for (const writesChunk of chunk(writes, 10)) {
|
||||
for (const writesChunk of chunkArray(writes, 10)) {
|
||||
await agent.com.atproto.repo.applyWrites({
|
||||
repo: currentAccount.did,
|
||||
writes: writesChunk,
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
moderateNotification,
|
||||
type ModerationOpts,
|
||||
} from '@atproto/api'
|
||||
import {chunkArray} from '@atproto/common-web'
|
||||
import {type QueryClient} from '@tanstack/react-query'
|
||||
import chunk from 'lodash.chunk'
|
||||
|
||||
import {labelIsHideableOffense} from '#/lib/moderation'
|
||||
import * as bsky from '#/types/bsky'
|
||||
@@ -221,8 +221,8 @@ async function fetchSubjects(
|
||||
packUris.add(notif.notification.reasonSubject)
|
||||
}
|
||||
}
|
||||
const postUriChunks = chunk(Array.from(postUris), 25)
|
||||
const packUriChunks = chunk(Array.from(packUris), 25)
|
||||
const postUriChunks = chunkArray(Array.from(postUris), 25)
|
||||
const packUriChunks = chunkArray(Array.from(packUris), 25)
|
||||
const postsChunks = await Promise.all(
|
||||
postUriChunks.map(uris =>
|
||||
agent.app.bsky.feed.getPosts({uris}).then(res => res.data.posts),
|
||||
|
||||
@@ -8,13 +8,13 @@ import {
|
||||
type BskyAgent,
|
||||
RichText,
|
||||
} from '@atproto/api'
|
||||
import {chunkArray} from '@atproto/common-web'
|
||||
import {
|
||||
type QueryClient,
|
||||
useMutation,
|
||||
useQuery,
|
||||
useQueryClient,
|
||||
} from '@tanstack/react-query'
|
||||
import chunk from 'lodash.chunk'
|
||||
|
||||
import {until} from '#/lib/async/until'
|
||||
import {createStarterPackList} from '#/lib/generate-starterpack'
|
||||
@@ -201,7 +201,7 @@ export function useEditStarterPackMutation({
|
||||
!profiles.find(p => p.did === i.subject.did && p.did),
|
||||
)
|
||||
if (removedItems.length !== 0) {
|
||||
const chunks = chunk(removedItems, 50)
|
||||
const chunks = chunkArray(removedItems, 50)
|
||||
for (const chunk of chunks) {
|
||||
await agent.com.atproto.repo.applyWrites({
|
||||
repo: agent.session!.did,
|
||||
@@ -218,7 +218,7 @@ export function useEditStarterPackMutation({
|
||||
p => !currentListItems.find(i => i.subject.did === p.did),
|
||||
)
|
||||
if (addedProfiles.length > 0) {
|
||||
const chunks = chunk(addedProfiles, 50)
|
||||
const chunks = chunkArray(addedProfiles, 50)
|
||||
for (const chunk of chunks) {
|
||||
await agent.com.atproto.repo.applyWrites({
|
||||
repo: agent.session!.did,
|
||||
|
||||
@@ -7785,13 +7785,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
|
||||
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
|
||||
|
||||
"@types/lodash.chunk@^4.2.7":
|
||||
version "4.2.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash.chunk/-/lodash.chunk-4.2.7.tgz#df52478072f0673d9fe8d3dd43af8f490d07a56a"
|
||||
integrity sha512-//tmaWHiANgToom/YYYKKqiCtlNz11fwYtMUUbaemNSbWTI+2zHtYW5nt1PHNCRWHPAJHHhn4UVFD9LKUFvatA==
|
||||
dependencies:
|
||||
"@types/lodash" "*"
|
||||
|
||||
"@types/lodash.debounce@^4.0.7":
|
||||
version "4.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash.debounce/-/lodash.debounce-4.0.7.tgz#0285879defb7cdb156ae633cecd62d5680eded9f"
|
||||
@@ -14543,11 +14536,6 @@ lodash.camelcase@^4.3.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
|
||||
integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==
|
||||
|
||||
lodash.chunk@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc"
|
||||
integrity sha512-ZzydJKfUHJwHa+hF5X66zLFCBrWn5GeF28OHEr4WVWtNDXlQ/IjWKPBiikqKo2ne0+v6JgCgJ0GzJp8k8bHC7w==
|
||||
|
||||
lodash.debounce@^4.0.8:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
||||
|
||||
Reference in New Issue
Block a user