@vendure/dashboard 3.7.4-master-202609160211 → 3.7.4-master-202609180211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./AP7HFJJL-DskxNkMk.js";
2
- import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-BVlr00rK.js";
1
+ import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./AP7HFJJL-CjVnFK_p.js";
2
+ import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-C0yRaSy4.js";
3
3
  var DevtoolsPanelComponent = (props) => {
4
4
  const [localStore, setLocalStore] = createLocalStorage({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,4 +1,4 @@
1
- import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, m as memo, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, n as mutationSortFns, p as on, q as setAttribute, r as getSidedProp, v as use, w as convertRemToPixels, x as createUniqueId, y as batch, z as getQueryStatusLabel, A as getMutationStatusColor, B as getQueryStatusColor, C as getQueryStatusColorByLabel, D as displayValue, F as For, E as untrack, $ as $TRACK, G as useTransition, H as spread, I as mergeProps, J as createRoot, K as serialize, L as Index, M as updateNestedDataByPath, N as addEventListener, O as stringify, Q as Match, R as Switch, T as deleteNestedDataByPath, U as splitProps, V as Dynamic, W as createComputed } from "./main-BVlr00rK.js";
1
+ import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, m as memo, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, n as mutationSortFns, p as on, q as setAttribute, r as getSidedProp, v as use, w as convertRemToPixels, x as createUniqueId, y as batch, z as getQueryStatusLabel, A as getMutationStatusColor, B as getQueryStatusColor, C as getQueryStatusColorByLabel, D as displayValue, F as For, E as untrack, $ as $TRACK, G as useTransition, H as spread, I as mergeProps, J as createRoot, K as serialize, L as Index, M as updateNestedDataByPath, N as addEventListener, O as stringify, Q as Match, R as Switch, T as deleteNestedDataByPath, U as splitProps, V as Dynamic, W as createComputed } from "./main-C0yRaSy4.js";
2
2
  var isNonNullable = (i2) => i2 != null;
3
3
  var filterNonNullable = (arr) => arr.filter(isNonNullable);
4
4
  function chain(callbacks) {
@@ -1,5 +1,5 @@
1
- import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./AP7HFJJL-DskxNkMk.js";
2
- import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-BVlr00rK.js";
1
+ import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./AP7HFJJL-CjVnFK_p.js";
2
+ import { g as getPreferredColorScheme, c as createMemo, a as createComponent } from "./main-C0yRaSy4.js";
3
3
  var DevtoolsComponent = (props) => {
4
4
  const [localStore, setLocalStore] = createLocalStorage({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,4 +1,4 @@
1
- import { op as normalizeDates$1, oq as startOfWeek$1, or as buildFormatLongFn$1, os as buildLocalizeFn$1, ot as buildMatchFn$1, ou as buildMatchPatternFn$1, ov as toDate$1, ow as match$1l, ox as localize$1n, oy as formatRelative$1n, oz as formatDistance$1n, oA as DateLib, oB as enUS$1 } from "./use-job-queue-polling-uDi2PfJd.js";
1
+ import { op as normalizeDates$1, oq as startOfWeek$1, or as buildFormatLongFn$1, os as buildLocalizeFn$1, ot as buildMatchFn$1, ou as buildMatchPatternFn$1, ov as toDate$1, ow as match$1l, ox as localize$1n, oy as formatRelative$1n, oz as formatDistance$1n, oA as DateLib, oB as enUS$1 } from "./use-job-queue-polling-BGkZa_AL.js";
2
2
  function isSameWeek$1(laterDate, earlierDate, options2) {
3
3
  const [laterDate_, earlierDate_] = normalizeDates$1(
4
4
  options2?.in,
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { c as createLucideIcon, nu as loadI18nMessages, nE as UserSettingsProvider, nF as ThemeProvider, nG as AuthProvider, nH as ServerConfigProvider, nI as ChannelProvider, nJ as AlertsProvider, l5 as CustomProviders, df as objectType, du as stringType, mV as useAuth, gv as LoginForm, hq as LoginBranding, gk as AppLayout, nK as endOfDay, nL as startOfMonth, bD as useUserSettings, nc as usePermissions, kx as getDashboardWidgetRegistry, eL as Page, eM as PageTitle, eN as PageActionBar, me as ActionBarItem, gi as DateRangePicker, dP as Button, eP as PageLayout, mp as FullWidthPageBlock, kA as WidgetFiltersProvider, i$ as GridLayout, ky as getDashboardWidget, nb as usePaginatedList, mF as api, kV as getMutationName, fA as DataTableBulkActionItem, nM as Trash, mN as graphql, gf as useGeneratedColumns, fU as DataTable, gY as CountrySelector, jt as Sheet, jA as SheetTrigger, jv as SheetContent, jy as SheetHeader, jz as SheetTitle, jw as SheetDescription, jm as ScrollArea, mx as ListPage, dQ as Plus, h3 as DetailPageButton, eX as BooleanDisplayBadge, dR as Badge, mS as setSettingsStoreValueDocument, nN as createColumnHelper, gX as CopyableText, jV as Switch$1, iE as Dialog, iM as DialogTrigger, iG as DialogContent, iJ as DialogHeader, iD as DialogTitle, iH as DialogDescription, eZ as JsonViewer, iI as DialogFooter, dO as Input, n7 as useLocalFormat, bR as DropdownMenu, bS as DropdownMenuTrigger, bT as Ellipsis, bV as DropdownMenuContent, bW as DropdownMenuItem, nO as Clock, nP as Check, nQ as RefreshCw, nR as ChevronDown, nS as EllipsisVertical, bF as Select, bG as SelectTrigger, bI as SelectValue, bJ as SelectContent, bK as SelectItem, gJ as AssignToChannelBulkAction, mW as useChannel, hs as RemoveFromChannelBulkAction, mJ as configurableOperationFragment, nq as LS_KEY_SHIPPING_TEST_ADDRESS, hR as AccordionItem, hS as AccordionTrigger, hQ as AccordionContent, i_ as Form, eS as FormFieldWrapper, nT as AddressCountrySelect, nr as LS_KEY_SHIPPING_TEST_ORDER, nU as useReactTable, nV as getCoreRowModel, jW as Table, k0 as TableHeader, k1 as TableRow, j$ as TableHead, nW as flexRender, jX as TableBody, jZ as TableCell, hr as ProductVariantSelector, hJ as VendureImage, bZ as Trash2, e$ as Money, ij as Card, ip as CardHeader, iq as CardTitle, il as CardContent, i3 as Alert, i4 as AlertDescription, hP as Accordion, hG as RichTextDescriptionCell, nt as SUPER_ADMIN_ROLE_CODE, nl as CUSTOMER_ROLE_CODE, nX as Layers, gP as ChannelCodeLabel, hz as RoleCodeLabel, mH as getEntityDuplicatorsDocument, nY as getInitialConfigArgValue, gS as ConfigurableOperationInput, mG as duplicateEntityDocument, nZ as Copy, h5 as ErrorPage, kI as extendDetailFormQuery, kP as addCustomFields, mA as getDetailQueryOptions, eJ as useDetailPage, eQ as PageBlock, eR as DetailFormGrid, jd as PasswordInput, eU as CustomFieldsPageBlock, mI as assetFragment, h7 as FacetValueSelector, h6 as FacetValueChip, gL as usePriceFactor, fF as FacetValueFacetedFilter, hC as StockLevelLabel, mM as errorResultFragment, mL as configurableOperationDefFragment, bC as useServerConfig, hD as CustomerCell, hE as OrderStateCell, hF as OrderMoneyCell, eH as NEW_ENTITY_PATH, hh as LanguageSelector, mP as schemaLanguageCodes, fb as NumberInput, hn as PaginatedListDataTable, hm as PaginatedListDataTableKey, h2 as CustomerSelector, n_ as useDebounce, bX as Folder, n$ as Search, o0 as ChevronRight, o1 as getExpandedRowModel, fO as getItemParentId, fR as calculateDragTargetPosition, fQ as isCircularReference, fS as calculateSiblingIndex, o2 as deleteAssetsDocument, cW as enumType, cP as coerce, gD as AssetGallery, mw as detailPageRouteLoader, hH as TaxCategorySelector, hO as ZoneSelector, k7 as Textarea, gV as ConfigurableOperationSelector, eT as TranslatableFormFieldWrapper, fq as RichTextInput, n5 as useGroupedPermissions, ke as TooltipProvider, kc as Tooltip, kf as TooltipTrigger, o3 as Info, kd as TooltipContent, gQ as ChannelSelector, gU as ConfigurableOperationMultiSelector, f7 as DateTimeInput, dS as X, cM as arrayType, nD as a, k2 as Tabs, k4 as TabsList, k5 as TabsTrigger, o4 as Link$1, k3 as TabsContent, iu as Command, iy as CommandInput, iA as CommandList, iw as CommandEmpty, iz as CommandItem, cO as booleanType, cl as ZodIssueCode, dq as recordType, C as Checkbox, iQ as Field, iT as FieldError, fa as MoneyInput, gW as ConfirmationDialog, hU as AlertDialog, hX as AlertDialogContent, h_ as AlertDialogHeader, hT as AlertDialogTitle, hY as AlertDialogDescription, hZ as AlertDialogFooter, hW as AlertDialogCancel, hV as AlertDialogAction, ho as PermissionGuard, na as usePage, fs as SlugInput, gN as AssignedFacetValues, gM as AssignedChannels, h4 as EntityAssets, dV as Separator, g_ as CustomFieldsForm, iV as FieldLabel, m$ as useDynamicTranslations, o5 as getTypeForState, bH as cn, nn as DEFAULT_CHANNEL_CODE, fp as createRelationSelectorConfig, fo as RelationSelector, j5 as Label, o6 as CircleAlert, mX as useCustomFieldConfig, gj as LabeledData, ir as Collapsible, is as CollapsibleTrigger, it as CollapsibleContent, o7 as Globe, md as HistoryEntry, o8 as SquarePen, hf as useHistoryNoteEditor, hd as HistoryTimelineWithGrouping, hc as HistoryNoteInput, ha as HistoryNoteEditor, hb as HistoryNoteEntry, jS as Skeleton, kR as getFieldsFromDocumentNode, fL as getColumnVisibility, o9 as Pencil, oa as stateTypeToBadgeVariant, ob as ChevronLeft, g$ as CustomerAddressForm$1, oc as Users, h0 as CustomerGroupChip, h1 as CustomerGroupSelector, od as availableCountriesQueryKey, oe as Eye, i5 as AlertTitle, n6 as useJobQueuePolling, hB as SellerSelector, gZ as CurrencySelector, of as tagListDocument, og as updateTagDocument, oh as deleteTagDocument, oi as createTagDocument, je as Popover, jj as PopoverTrigger, oj as ChevronsUpDown, jf as PopoverContent, ix as CommandGroup, ok as Settings2, ol as assetDetailDocument, om as assetUpdateDocument, gB as AssetFocalPointEditor, gI as AssetProperties, gG as AssetPreviewSelector, on as Focus, hA as RoleSelector, hj as MultiSelect, oo as useRedirectToListOnNotFound, fh as SingleRelationInput, lD as useGeneratedForm, de as numberType, f0 as AffixedInput, iF as DialogClose, jU as Spinner, lq as useDashboardExtensions, kH as registerDefaults, l7 as executeDashboardExtensionCallbacks, jT as Toaster, mB as useExtendedRouter, mZ as useDisplayLocale, nh as useUiLanguageLoader, kL as setCustomFieldsMap, iN as DirectionProvider, kM as clearCustomFieldsMap } from "./use-job-queue-polling-uDi2PfJd.js";
2
+ import { c as createLucideIcon, nu as loadI18nMessages, nE as UserSettingsProvider, nF as ThemeProvider, nG as AuthProvider, nH as ServerConfigProvider, nI as ChannelProvider, nJ as AlertsProvider, l5 as CustomProviders, df as objectType, du as stringType, mV as useAuth, gv as LoginForm, hq as LoginBranding, gk as AppLayout, nK as endOfDay, nL as startOfMonth, bD as useUserSettings, nc as usePermissions, kx as getDashboardWidgetRegistry, eL as Page, eM as PageTitle, eN as PageActionBar, me as ActionBarItem, gi as DateRangePicker, dP as Button, eP as PageLayout, mp as FullWidthPageBlock, kA as WidgetFiltersProvider, i$ as GridLayout, ky as getDashboardWidget, nb as usePaginatedList, mF as api, kV as getMutationName, fA as DataTableBulkActionItem, nM as Trash, mN as graphql, gf as useGeneratedColumns, fU as DataTable, gY as CountrySelector, jt as Sheet, jA as SheetTrigger, jv as SheetContent, jy as SheetHeader, jz as SheetTitle, jw as SheetDescription, jm as ScrollArea, mx as ListPage, dQ as Plus, h3 as DetailPageButton, eX as BooleanDisplayBadge, dR as Badge, mS as setSettingsStoreValueDocument, nN as createColumnHelper, gX as CopyableText, jV as Switch$1, iE as Dialog, iM as DialogTrigger, iG as DialogContent, iJ as DialogHeader, iD as DialogTitle, iH as DialogDescription, eZ as JsonViewer, iI as DialogFooter, dO as Input, n7 as useLocalFormat, bR as DropdownMenu, bS as DropdownMenuTrigger, bT as Ellipsis, bV as DropdownMenuContent, bW as DropdownMenuItem, nO as Clock, nP as Check, nQ as RefreshCw, nR as ChevronDown, nS as EllipsisVertical, bF as Select, bG as SelectTrigger, bI as SelectValue, bJ as SelectContent, bK as SelectItem, gJ as AssignToChannelBulkAction, mW as useChannel, hs as RemoveFromChannelBulkAction, mJ as configurableOperationFragment, nq as LS_KEY_SHIPPING_TEST_ADDRESS, hR as AccordionItem, hS as AccordionTrigger, hQ as AccordionContent, i_ as Form, eS as FormFieldWrapper, nT as AddressCountrySelect, nr as LS_KEY_SHIPPING_TEST_ORDER, nU as useReactTable, nV as getCoreRowModel, jW as Table, k0 as TableHeader, k1 as TableRow, j$ as TableHead, nW as flexRender, jX as TableBody, jZ as TableCell, hr as ProductVariantSelector, hJ as VendureImage, bZ as Trash2, e$ as Money, ij as Card, ip as CardHeader, iq as CardTitle, il as CardContent, i3 as Alert, i4 as AlertDescription, hP as Accordion, hG as RichTextDescriptionCell, nt as SUPER_ADMIN_ROLE_CODE, nl as CUSTOMER_ROLE_CODE, nX as Layers, gP as ChannelCodeLabel, hz as RoleCodeLabel, mH as getEntityDuplicatorsDocument, nY as getInitialConfigArgValue, gS as ConfigurableOperationInput, mG as duplicateEntityDocument, nZ as Copy, h5 as ErrorPage, kI as extendDetailFormQuery, kP as addCustomFields, mA as getDetailQueryOptions, eJ as useDetailPage, eQ as PageBlock, eR as DetailFormGrid, jd as PasswordInput, eU as CustomFieldsPageBlock, mI as assetFragment, h7 as FacetValueSelector, h6 as FacetValueChip, gL as usePriceFactor, fF as FacetValueFacetedFilter, hC as StockLevelLabel, mM as errorResultFragment, mL as configurableOperationDefFragment, bC as useServerConfig, hD as CustomerCell, hE as OrderStateCell, hF as OrderMoneyCell, eH as NEW_ENTITY_PATH, hh as LanguageSelector, mP as schemaLanguageCodes, fb as NumberInput, hn as PaginatedListDataTable, hm as PaginatedListDataTableKey, h2 as CustomerSelector, n_ as useDebounce, bX as Folder, n$ as Search, o0 as ChevronRight, o1 as getExpandedRowModel, fO as getItemParentId, fR as calculateDragTargetPosition, fQ as isCircularReference, fS as calculateSiblingIndex, o2 as deleteAssetsDocument, cW as enumType, cP as coerce, gD as AssetGallery, mw as detailPageRouteLoader, hH as TaxCategorySelector, hO as ZoneSelector, k7 as Textarea, gV as ConfigurableOperationSelector, eT as TranslatableFormFieldWrapper, fq as RichTextInput, n5 as useGroupedPermissions, ke as TooltipProvider, kc as Tooltip, kf as TooltipTrigger, o3 as Info, kd as TooltipContent, gQ as ChannelSelector, gU as ConfigurableOperationMultiSelector, f7 as DateTimeInput, dS as X, cM as arrayType, nD as a, k2 as Tabs, k4 as TabsList, k5 as TabsTrigger, o4 as Link$1, k3 as TabsContent, iu as Command, iy as CommandInput, iA as CommandList, iw as CommandEmpty, iz as CommandItem, cO as booleanType, cl as ZodIssueCode, dq as recordType, C as Checkbox, iQ as Field, iT as FieldError, fa as MoneyInput, gW as ConfirmationDialog, hU as AlertDialog, hX as AlertDialogContent, h_ as AlertDialogHeader, hT as AlertDialogTitle, hY as AlertDialogDescription, hZ as AlertDialogFooter, hW as AlertDialogCancel, hV as AlertDialogAction, ho as PermissionGuard, na as usePage, fs as SlugInput, gN as AssignedFacetValues, gM as AssignedChannels, h4 as EntityAssets, dV as Separator, g_ as CustomFieldsForm, iV as FieldLabel, m$ as useDynamicTranslations, o5 as getTypeForState, bH as cn, nn as DEFAULT_CHANNEL_CODE, fp as createRelationSelectorConfig, fo as RelationSelector, j5 as Label, o6 as CircleAlert, mX as useCustomFieldConfig, gj as LabeledData, ir as Collapsible, is as CollapsibleTrigger, it as CollapsibleContent, o7 as Globe, md as HistoryEntry, o8 as SquarePen, hf as useHistoryNoteEditor, hd as HistoryTimelineWithGrouping, hc as HistoryNoteInput, ha as HistoryNoteEditor, hb as HistoryNoteEntry, jS as Skeleton, kR as getFieldsFromDocumentNode, fL as getColumnVisibility, o9 as Pencil, oa as stateTypeToBadgeVariant, ob as ChevronLeft, g$ as CustomerAddressForm$1, oc as Users, h0 as CustomerGroupChip, h1 as CustomerGroupSelector, od as availableCountriesQueryKey, oe as Eye, i5 as AlertTitle, n6 as useJobQueuePolling, hB as SellerSelector, gZ as CurrencySelector, of as tagListDocument, og as updateTagDocument, oh as deleteTagDocument, oi as createTagDocument, je as Popover, jj as PopoverTrigger, oj as ChevronsUpDown, jf as PopoverContent, ix as CommandGroup, ok as Settings2, ol as assetDetailDocument, om as assetUpdateDocument, gB as AssetFocalPointEditor, gI as AssetProperties, gG as AssetPreviewSelector, on as Focus, hA as RoleSelector, hj as MultiSelect, oo as useRedirectToListOnNotFound, fh as SingleRelationInput, lD as useGeneratedForm, de as numberType, f0 as AffixedInput, iF as DialogClose, jU as Spinner, lq as useDashboardExtensions, kH as registerDefaults, l7 as executeDashboardExtensionCallbacks, jT as Toaster, mB as useExtendedRouter, mZ as useDisplayLocale, nh as useUiLanguageLoader, kL as setCustomFieldsMap, iN as DirectionProvider, kM as clearCustomFieldsMap } from "./use-job-queue-polling-BGkZa_AL.js";
3
3
  import { toast } from "sonner";
4
4
  import { i18n } from "@lingui/core";
5
5
  import { I18nProvider as I18nProvider$1, useLingui, Trans } from "@lingui/react";
@@ -2948,7 +2948,7 @@ var TanstackQueryDevtools = class {
2948
2948
  if (this.#Component) {
2949
2949
  Devtools = this.#Component;
2950
2950
  } else {
2951
- Devtools = lazy(() => import("./WDYDFRGG-CdQxmxpT.js"));
2951
+ Devtools = lazy(() => import("./WDYDFRGG-BNhQ-gUX.js"));
2952
2952
  this.#Component = Devtools;
2953
2953
  }
2954
2954
  setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
@@ -3086,7 +3086,7 @@ var TanstackQueryDevtoolsPanel = class {
3086
3086
  if (this.#Component) {
3087
3087
  Devtools = this.#Component;
3088
3088
  } else {
3089
- Devtools = lazy(() => import("./2SSKDMRQ-z6PIkX8b.js"));
3089
+ Devtools = lazy(() => import("./2SSKDMRQ-DvYnkA4d.js"));
3090
3090
  this.#Component = Devtools;
3091
3091
  }
3092
3092
  setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
@@ -11014,6 +11014,153 @@ const collectionListForMoveDocument = graphql(`
11014
11014
  }
11015
11015
  }
11016
11016
  `);
11017
+ function usePaginatedChildCollections({
11018
+ expandedIds,
11019
+ pageSize,
11020
+ queryKeyPrefix,
11021
+ fetchChildren
11022
+ }) {
11023
+ const [accumulatedChildren, setAccumulatedChildren] = useState({});
11024
+ const [nextPageToFetch, setNextPageToFetch] = useState({});
11025
+ const childQueryKey = (parentId, page) => [queryKeyPrefix, parentId, "page", page];
11026
+ const firstPageChildQueries = useQueries({
11027
+ queries: expandedIds.filter((collectionId) => !accumulatedChildren[collectionId]).map((collectionId) => ({
11028
+ queryKey: childQueryKey(collectionId, 0),
11029
+ // The `queries` array is rebuilt from a dynamic, shifting set of
11030
+ // collectionIds, so the same array slot can hold an entirely different
11031
+ // collection's query across renders. Opt out of the global
11032
+ // `keepPreviousData` so an unrelated collection's stale children are never
11033
+ // shown as a placeholder while this one's first page is loading.
11034
+ placeholderData: void 0,
11035
+ queryFn: async () => {
11036
+ const {
11037
+ items,
11038
+ totalItems
11039
+ } = await fetchChildren(collectionId, pageSize, 0);
11040
+ return {
11041
+ collectionId,
11042
+ items,
11043
+ totalItems
11044
+ };
11045
+ }
11046
+ }))
11047
+ });
11048
+ useEffect(() => {
11049
+ const newChildren = {};
11050
+ let hasNew = false;
11051
+ for (const query of firstPageChildQueries) {
11052
+ if (query.data && !accumulatedChildren[query.data.collectionId]) {
11053
+ newChildren[query.data.collectionId] = {
11054
+ items: query.data.items,
11055
+ totalItems: query.data.totalItems
11056
+ };
11057
+ hasNew = true;
11058
+ }
11059
+ }
11060
+ if (hasNew) {
11061
+ setAccumulatedChildren((prev) => ({
11062
+ ...prev,
11063
+ ...newChildren
11064
+ }));
11065
+ }
11066
+ }, [firstPageChildQueries]);
11067
+ const pagedChildEntries = Object.entries(nextPageToFetch).filter(([, page]) => page > 0);
11068
+ const pagedChildQueries = useQueries({
11069
+ queries: pagedChildEntries.map(([collectionId, page]) => ({
11070
+ queryKey: childQueryKey(collectionId, page),
11071
+ // See the matching comment on firstPageChildQueries above.
11072
+ placeholderData: void 0,
11073
+ queryFn: async () => {
11074
+ const {
11075
+ items,
11076
+ totalItems
11077
+ } = await fetchChildren(collectionId, pageSize, page * pageSize);
11078
+ return {
11079
+ collectionId,
11080
+ items,
11081
+ totalItems
11082
+ };
11083
+ }
11084
+ }))
11085
+ });
11086
+ const pagedQueryByParentId = new Map(pagedChildEntries.map(([collectionId], index) => [collectionId, pagedChildQueries[index]]));
11087
+ useEffect(() => {
11088
+ let hasUpdates = false;
11089
+ const childUpdates = {};
11090
+ const fetchedPages = [];
11091
+ for (const query of pagedChildQueries) {
11092
+ if (!query.data) continue;
11093
+ const {
11094
+ collectionId,
11095
+ items,
11096
+ totalItems
11097
+ } = query.data;
11098
+ if (accumulatedChildren[collectionId]) {
11099
+ childUpdates[collectionId] = {
11100
+ items: [...accumulatedChildren[collectionId].items, ...items],
11101
+ totalItems
11102
+ };
11103
+ fetchedPages.push(collectionId);
11104
+ hasUpdates = true;
11105
+ }
11106
+ }
11107
+ if (hasUpdates) {
11108
+ setAccumulatedChildren((prev) => ({
11109
+ ...prev,
11110
+ ...childUpdates
11111
+ }));
11112
+ setNextPageToFetch((prev) => {
11113
+ const next = {
11114
+ ...prev
11115
+ };
11116
+ for (const id of fetchedPages) {
11117
+ delete next[id];
11118
+ }
11119
+ return next;
11120
+ });
11121
+ }
11122
+ }, [pagedChildQueries]);
11123
+ const handleLoadMoreChildren = (parentId) => {
11124
+ const pendingQuery = pagedQueryByParentId.get(parentId);
11125
+ if (pendingQuery?.isError) {
11126
+ pendingQuery.refetch();
11127
+ return;
11128
+ }
11129
+ const currentItems = accumulatedChildren[parentId]?.items.length ?? 0;
11130
+ const nextPage = Math.floor(currentItems / pageSize);
11131
+ setNextPageToFetch((prev) => ({
11132
+ ...prev,
11133
+ [parentId]: nextPage
11134
+ }));
11135
+ };
11136
+ const resetChildren = (parentIds) => {
11137
+ if (!parentIds) {
11138
+ setAccumulatedChildren({});
11139
+ setNextPageToFetch({});
11140
+ return;
11141
+ }
11142
+ setAccumulatedChildren((prev) => {
11143
+ const next = {
11144
+ ...prev
11145
+ };
11146
+ parentIds.forEach((id) => delete next[id]);
11147
+ return next;
11148
+ });
11149
+ setNextPageToFetch((prev) => {
11150
+ const next = {
11151
+ ...prev
11152
+ };
11153
+ parentIds.forEach((id) => delete next[id]);
11154
+ return next;
11155
+ });
11156
+ };
11157
+ return {
11158
+ accumulatedChildren,
11159
+ handleLoadMoreChildren,
11160
+ resetChildren
11161
+ };
11162
+ }
11163
+ const CHILDREN_PAGE_SIZE$1 = 20;
11017
11164
  function TargetAlert({
11018
11165
  selectedCollectionId,
11019
11166
  collectionsToMove,
@@ -11060,7 +11207,9 @@ function CollectionTreeNode({
11060
11207
  onSelect,
11061
11208
  selectedCollectionId,
11062
11209
  collectionsToMove,
11063
- childCollectionsByParentId
11210
+ childCollectionsByParentId,
11211
+ childTotalsByParentId,
11212
+ onLoadMoreChildren
11064
11213
  }) {
11065
11214
  const hasChildren = collection.children && collection.children.length > 0;
11066
11215
  const isExpanded = expanded[collection.id];
@@ -11069,6 +11218,7 @@ function CollectionTreeNode({
11069
11218
  const isChildOfBeingMoved = collectionsToMove.some((c) => collection.breadcrumbs.some((b) => b.id === c.id));
11070
11219
  const isSelectable = !isBeingMoved && !isChildOfBeingMoved;
11071
11220
  const childCollections = childCollectionsByParentId[collection.id] || [];
11221
+ const hasMoreChildren = (childTotalsByParentId[collection.id] ?? 0) > childCollections.length;
11072
11222
  return /* @__PURE__ */ jsxs("div", { className: "my-0.5", children: [
11073
11223
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", style: {
11074
11224
  marginLeft: depth * 20
@@ -11088,7 +11238,15 @@ function CollectionTreeNode({
11088
11238
  ] })
11089
11239
  ] }) })
11090
11240
  ] }),
11091
- hasChildren && isExpanded && /* @__PURE__ */ jsx("div", { children: childCollections.map((childCollection) => /* @__PURE__ */ jsx(CollectionTreeNode, { collection: childCollection, depth: depth + 1, expanded, onToggleExpanded, onSelect, selectedCollectionId, collectionsToMove, childCollectionsByParentId }, childCollection.id)) })
11241
+ hasChildren && isExpanded && /* @__PURE__ */ jsxs("div", { children: [
11242
+ childCollections.map((childCollection) => /* @__PURE__ */ jsx(CollectionTreeNode, { collection: childCollection, depth: depth + 1, expanded, onToggleExpanded, onSelect, selectedCollectionId, collectionsToMove, childCollectionsByParentId, childTotalsByParentId, onLoadMoreChildren }, childCollection.id)),
11243
+ hasMoreChildren && /* @__PURE__ */ jsx("button", { type: "button", className: "text-xs text-muted-foreground hover:text-foreground py-1.5 px-3", style: {
11244
+ marginLeft: (depth + 1) * 20
11245
+ }, onClick: () => onLoadMoreChildren(collection.id), children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11246
+ {
11247
+ id: "yQ2kGp"
11248
+ } }) })
11249
+ ] })
11092
11250
  ] });
11093
11251
  }
11094
11252
  function MoveCollectionsDialog({
@@ -11108,7 +11266,6 @@ function MoveCollectionsDialog({
11108
11266
  _: _t
11109
11267
  } = useLingui();
11110
11268
  const collectionForMoveKey = ["collectionsForMove", debouncedSearchTerm];
11111
- const childCollectionsForMoveKey = (collectionId) => collectionId ? ["childCollectionsForMove", collectionId] : ["childCollectionsForMove"];
11112
11269
  const {
11113
11270
  data: collectionsData,
11114
11271
  isLoading
@@ -11131,33 +11288,44 @@ function MoveCollectionsDialog({
11131
11288
  });
11132
11289
  const topLevelCollectionId = collectionsData?.collections.items[0]?.parentId;
11133
11290
  const selectionHasTopLevelParent = collectionsToMove.some((c) => c.parentId === topLevelCollectionId);
11134
- const childrenQueries = useQueries({
11135
- queries: Object.entries(expanded).map(([collectionId, isExpanded]) => {
11136
- return {
11137
- queryKey: childCollectionsForMoveKey(collectionId),
11138
- queryFn: () => api.query(collectionListForMoveDocument, {
11139
- options: {
11140
- filter: {
11141
- parentId: {
11142
- eq: collectionId
11143
- }
11291
+ const {
11292
+ accumulatedChildren,
11293
+ handleLoadMoreChildren,
11294
+ resetChildren
11295
+ } = usePaginatedChildCollections({
11296
+ expandedIds: Object.entries(expanded).filter(([, isExpanded]) => isExpanded).map(([collectionId]) => collectionId),
11297
+ pageSize: CHILDREN_PAGE_SIZE$1,
11298
+ queryKeyPrefix: "childCollectionsForMove",
11299
+ fetchChildren: async (parentId, take, skip) => {
11300
+ const result = await api.query(collectionListForMoveDocument, {
11301
+ options: {
11302
+ filter: {
11303
+ parentId: {
11304
+ eq: parentId
11144
11305
  }
11145
- }
11146
- })
11147
- };
11148
- })
11149
- });
11150
- const childCollectionsByParentId = childrenQueries.reduce((acc, query, index) => {
11151
- const collectionId = Object.keys(expanded)[index];
11152
- if (query.data) {
11153
- const collections2 = query.data.collections.items;
11154
- collections2.forEach((collection) => {
11155
- collectionNameCache.current.set(collection.id, collection.name);
11306
+ },
11307
+ take,
11308
+ skip
11309
+ }
11156
11310
  });
11157
- acc[collectionId] = collections2;
11311
+ return {
11312
+ items: result.collections.items,
11313
+ totalItems: result.collections.totalItems
11314
+ };
11158
11315
  }
11159
- return acc;
11160
- }, {});
11316
+ });
11317
+ const childCollectionsByParentId = {};
11318
+ const childTotalsByParentId = {};
11319
+ for (const [collectionId, {
11320
+ items,
11321
+ totalItems
11322
+ }] of Object.entries(accumulatedChildren)) {
11323
+ items.forEach((collection) => {
11324
+ collectionNameCache.current.set(collection.id, collection.name);
11325
+ });
11326
+ childCollectionsByParentId[collectionId] = items;
11327
+ childTotalsByParentId[collectionId] = totalItems;
11328
+ }
11161
11329
  const moveCollectionsMutation = useMutation({
11162
11330
  mutationFn: api.mutate(moveCollectionDocument),
11163
11331
  onSuccess: () => {
@@ -11170,9 +11338,10 @@ function MoveCollectionsDialog({
11170
11338
  queryClient2.invalidateQueries({
11171
11339
  queryKey: collectionForMoveKey
11172
11340
  });
11173
- queryClient2.invalidateQueries({
11174
- queryKey: childCollectionsForMoveKey()
11341
+ queryClient2.removeQueries({
11342
+ queryKey: ["childCollectionsForMove"]
11175
11343
  });
11344
+ resetChildren();
11176
11345
  onResetExpanded?.();
11177
11346
  onSuccess?.();
11178
11347
  onOpenChange(false);
@@ -11220,57 +11389,64 @@ function MoveCollectionsDialog({
11220
11389
  collections.forEach((collection) => {
11221
11390
  collectionNameCache.current.set(collection.id, collection.name);
11222
11391
  });
11223
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[600px] h-[90vh] flex flex-col p-0 gap-0", children: [
11224
- /* @__PURE__ */ jsxs(DialogHeader, { className: "px-6 pt-6 pb-4", children: [
11225
- /* @__PURE__ */ jsx(DialogTitle, { children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11226
- {
11227
- id: "5D6pgx"
11228
- } }) }),
11229
- /* @__PURE__ */ jsx(DialogDescription, { children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11230
- {
11231
- id: "d5sEuA",
11232
- values: {
11233
- 0: collectionsToMove.length === 1 ? "this collection" : `${collectionsToMove.length} collections`
11234
- }
11235
- } }) })
11236
- ] }),
11237
- /* @__PURE__ */ jsx("div", { className: "px-6 py-3 bg-muted/50 border-y shrink-0", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: collectionsToMove.map((collection) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-1 bg-background border rounded-md text-sm", children: [
11238
- /* @__PURE__ */ jsx(Folder, { className: "h-3 w-3 text-muted-foreground" }),
11239
- /* @__PURE__ */ jsx("span", { children: collection.name })
11240
- ] }, collection.id)) }) }),
11241
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-auto px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col gap-3", children: [
11242
- /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
11243
- /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
11244
- /* @__PURE__ */ jsx(Input, { placeholder: _t(
11245
- /*i18n*/
11392
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
11393
+ DialogContent,
11394
+ {
11395
+ className: "sm:max-w-[600px] h-[90vh] flex flex-col p-0 gap-0",
11396
+ onKeyDown: (e) => e.stopPropagation(),
11397
+ children: [
11398
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "px-6 pt-6 pb-4", children: [
11399
+ /* @__PURE__ */ jsx(DialogTitle, { children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11246
11400
  {
11247
- id: "ErxaU3"
11248
- }
11249
- ), value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), className: "pl-10" })
11250
- ] }),
11251
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11252
- {
11253
- id: "y+JWgj"
11254
- } }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11255
- !debouncedSearchTerm && !selectionHasTopLevelParent && /* @__PURE__ */ jsx(MoveToTopLevel, { selectedCollectionId, topLevelCollectionId, onSelect: setSelectedCollectionId }),
11256
- collections.map((collection) => /* @__PURE__ */ jsx(CollectionTreeNode, { collection, depth: 0, expanded, onToggleExpanded: handleToggleExpanded, onSelect: handleSelect, selectedCollectionId, collectionsToMove, childCollectionsByParentId }, collection.id))
11257
- ] }) }),
11258
- /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(TargetAlert, { selectedCollectionId, collectionsToMove, topLevelCollectionId, collectionNameCache }) })
11259
- ] }) }),
11260
- /* @__PURE__ */ jsxs(DialogFooter, { className: "px-6 pb-6 pt-4 shrink-0", children: [
11261
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11262
- {
11263
- id: "dEgA5A"
11264
- } }) }),
11265
- /* @__PURE__ */ jsx(Button, { onClick: handleMove, disabled: !selectedCollectionId || moveCollectionsMutation.isPending, children: moveCollectionsMutation.isPending ? /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11266
- {
11267
- id: "K8Qnlj"
11268
- } }) : /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11269
- {
11270
- id: "5D6pgx"
11271
- } }) })
11272
- ] })
11273
- ] }) });
11401
+ id: "5D6pgx"
11402
+ } }) }),
11403
+ /* @__PURE__ */ jsx(DialogDescription, { children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11404
+ {
11405
+ id: "d5sEuA",
11406
+ values: {
11407
+ 0: collectionsToMove.length === 1 ? "this collection" : `${collectionsToMove.length} collections`
11408
+ }
11409
+ } }) })
11410
+ ] }),
11411
+ /* @__PURE__ */ jsx("div", { className: "px-6 py-3 bg-muted/50 border-y shrink-0", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: collectionsToMove.map((collection) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-1 bg-background border rounded-md text-sm", children: [
11412
+ /* @__PURE__ */ jsx(Folder, { className: "h-3 w-3 text-muted-foreground" }),
11413
+ /* @__PURE__ */ jsx("span", { children: collection.name })
11414
+ ] }, collection.id)) }) }),
11415
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-auto px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col gap-3", children: [
11416
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
11417
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
11418
+ /* @__PURE__ */ jsx(Input, { placeholder: _t(
11419
+ /*i18n*/
11420
+ {
11421
+ id: "ErxaU3"
11422
+ }
11423
+ ), value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), className: "pl-10" })
11424
+ ] }),
11425
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11426
+ {
11427
+ id: "y+JWgj"
11428
+ } }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11429
+ !debouncedSearchTerm && !selectionHasTopLevelParent && /* @__PURE__ */ jsx(MoveToTopLevel, { selectedCollectionId, topLevelCollectionId, onSelect: setSelectedCollectionId }),
11430
+ collections.map((collection) => /* @__PURE__ */ jsx(CollectionTreeNode, { collection, depth: 0, expanded, onToggleExpanded: handleToggleExpanded, onSelect: handleSelect, selectedCollectionId, collectionsToMove, childCollectionsByParentId, childTotalsByParentId, onLoadMoreChildren: handleLoadMoreChildren }, collection.id))
11431
+ ] }) }),
11432
+ /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(TargetAlert, { selectedCollectionId, collectionsToMove, topLevelCollectionId, collectionNameCache }) })
11433
+ ] }) }),
11434
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "px-6 pb-6 pt-4 shrink-0", children: [
11435
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), children: /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11436
+ {
11437
+ id: "dEgA5A"
11438
+ } }) }),
11439
+ /* @__PURE__ */ jsx(Button, { onClick: handleMove, disabled: !selectedCollectionId || moveCollectionsMutation.isPending, children: moveCollectionsMutation.isPending ? /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11440
+ {
11441
+ id: "K8Qnlj"
11442
+ } }) : /* @__PURE__ */ jsx(Trans, { .../*i18n*/
11443
+ {
11444
+ id: "5D6pgx"
11445
+ } }) })
11446
+ ] })
11447
+ ]
11448
+ }
11449
+ ) });
11274
11450
  }
11275
11451
  const AssignCollectionsToChannelBulkAction = ({
11276
11452
  selection,
@@ -11476,8 +11652,6 @@ function CollectionListPage() {
11476
11652
  });
11477
11653
  const [expanded, setExpandedState] = useState(() => parseExpandedParam(routeSearch.expanded));
11478
11654
  const [searchTerm, setSearchTerm] = useState("");
11479
- const [accumulatedChildren, setAccumulatedChildren] = useState({});
11480
- const [nextPageToFetch, setNextPageToFetch] = useState({});
11481
11655
  const setExpanded = useCallback((updater) => {
11482
11656
  setExpandedState((prev) => {
11483
11657
  const next = typeof updater === "function" ? updater(prev) : updater;
@@ -11491,111 +11665,32 @@ function CollectionListPage() {
11491
11665
  return next;
11492
11666
  });
11493
11667
  }, [navigate]);
11494
- const firstPageChildQueries = useQueries({
11495
- queries: expanded === true ? [] : Object.entries(expanded).filter(([collectionId]) => !accumulatedChildren[collectionId]).map(([collectionId]) => {
11496
- return {
11497
- queryKey: ["childCollections", collectionId, "page", 0],
11498
- queryFn: async () => {
11499
- const result = await api.query(collectionListDocument, {
11500
- options: {
11501
- filter: {
11502
- parentId: {
11503
- eq: collectionId
11504
- }
11505
- },
11506
- take: CHILDREN_PAGE_SIZE,
11507
- skip: 0
11668
+ const {
11669
+ accumulatedChildren,
11670
+ handleLoadMoreChildren,
11671
+ resetChildren
11672
+ } = usePaginatedChildCollections({
11673
+ expandedIds: expanded === true ? [] : Object.entries(expanded).filter(([, isExpanded]) => isExpanded).map(([collectionId]) => collectionId),
11674
+ pageSize: CHILDREN_PAGE_SIZE,
11675
+ queryKeyPrefix: "childCollections",
11676
+ fetchChildren: async (parentId, take, skip) => {
11677
+ const result = await api.query(collectionListDocument, {
11678
+ options: {
11679
+ filter: {
11680
+ parentId: {
11681
+ eq: parentId
11508
11682
  }
11509
- });
11510
- return {
11511
- collectionId,
11512
- items: result.collections.items,
11513
- totalItems: result.collections.totalItems
11514
- };
11683
+ },
11684
+ take,
11685
+ skip
11515
11686
  }
11516
- };
11517
- })
11518
- });
11519
- useEffect(() => {
11520
- const newChildren = {};
11521
- let hasNew = false;
11522
- for (const query of firstPageChildQueries) {
11523
- if (query.data && !accumulatedChildren[query.data.collectionId]) {
11524
- newChildren[query.data.collectionId] = {
11525
- items: query.data.items,
11526
- totalItems: query.data.totalItems
11527
- };
11528
- hasNew = true;
11529
- }
11530
- }
11531
- if (hasNew) {
11532
- setAccumulatedChildren((prev) => ({
11533
- ...prev,
11534
- ...newChildren
11535
- }));
11536
- }
11537
- }, [firstPageChildQueries]);
11538
- const pagedChildQueries = useQueries({
11539
- queries: Object.entries(nextPageToFetch).filter(([_, page]) => page > 0).map(([collectionId, page]) => {
11687
+ });
11540
11688
  return {
11541
- queryKey: ["childCollections", collectionId, "page", page],
11542
- queryFn: async () => {
11543
- const result = await api.query(collectionListDocument, {
11544
- options: {
11545
- filter: {
11546
- parentId: {
11547
- eq: collectionId
11548
- }
11549
- },
11550
- take: CHILDREN_PAGE_SIZE,
11551
- skip: page * CHILDREN_PAGE_SIZE
11552
- }
11553
- });
11554
- return {
11555
- collectionId,
11556
- items: result.collections.items,
11557
- totalItems: result.collections.totalItems
11558
- };
11559
- }
11689
+ items: result.collections.items,
11690
+ totalItems: result.collections.totalItems
11560
11691
  };
11561
- })
11562
- });
11563
- useEffect(() => {
11564
- let hasUpdates = false;
11565
- const childUpdates = {};
11566
- const fetchedPages = [];
11567
- for (const query of pagedChildQueries) {
11568
- if (!query.data) continue;
11569
- const {
11570
- collectionId,
11571
- items,
11572
- totalItems
11573
- } = query.data;
11574
- if (accumulatedChildren[collectionId]) {
11575
- childUpdates[collectionId] = {
11576
- items: [...accumulatedChildren[collectionId].items, ...items],
11577
- totalItems
11578
- };
11579
- fetchedPages.push(collectionId);
11580
- hasUpdates = true;
11581
- }
11582
- }
11583
- if (hasUpdates) {
11584
- setAccumulatedChildren((prev) => ({
11585
- ...prev,
11586
- ...childUpdates
11587
- }));
11588
- setNextPageToFetch((prev) => {
11589
- const next = {
11590
- ...prev
11591
- };
11592
- for (const id of fetchedPages) {
11593
- delete next[id];
11594
- }
11595
- return next;
11596
- });
11597
11692
  }
11598
- }, [pagedChildQueries]);
11693
+ });
11599
11694
  const addSubCollections = (data) => {
11600
11695
  const allRows = [];
11601
11696
  const addSubRows = (row) => {
@@ -11631,14 +11726,6 @@ function CollectionListPage() {
11631
11726
  });
11632
11727
  return allRows;
11633
11728
  };
11634
- const handleLoadMoreChildren = (parentId) => {
11635
- const currentItems = accumulatedChildren[parentId]?.items.length ?? 0;
11636
- const nextPage = Math.floor(currentItems / CHILDREN_PAGE_SIZE);
11637
- setNextPageToFetch((prev) => ({
11638
- ...prev,
11639
- [parentId]: nextPage
11640
- }));
11641
- };
11642
11729
  const handleReorder = async (oldIndex, newIndex, item, allItems) => {
11643
11730
  if (isLoadMoreRow(item)) {
11644
11731
  return;
@@ -11695,16 +11782,7 @@ function CollectionListPage() {
11695
11782
  queryKey: ["childCollections", targetParentId]
11696
11783
  });
11697
11784
  }
11698
- setAccumulatedChildren((prev) => {
11699
- const newState = {
11700
- ...prev
11701
- };
11702
- delete newState[sourceParentId];
11703
- if (targetParentId !== sourceParentId) {
11704
- delete newState[targetParentId];
11705
- }
11706
- return newState;
11707
- });
11785
+ resetChildren(targetParentId !== sourceParentId ? [sourceParentId, targetParentId] : [sourceParentId]);
11708
11786
  await queryClient2.invalidateQueries({
11709
11787
  queryKey: ["PaginatedListDataTable"]
11710
11788
  });
@@ -11842,7 +11920,7 @@ function CollectionListPage() {
11842
11920
  queryClient2.removeQueries({
11843
11921
  queryKey: ["PaginatedListDataTable"]
11844
11922
  });
11845
- setAccumulatedChildren({});
11923
+ resetChildren();
11846
11924
  },
11847
11925
  isUtilityRow: (row) => isLoadMoreRow(row.original),
11848
11926
  renderUtilityRow: (row) => {