@@ -34,7 +34,7 @@ import { useConfirm } from '@teable/ui-lib/base';
3434import { toast } from '@teable/ui-lib/shadcn/ui/sonner' ;
3535import type { AxiosResponse } from 'axios' ;
3636import { useTranslation } from 'next-i18next' ;
37- import { useCallback } from 'react' ;
37+ import { useCallback , useMemo } from 'react' ;
3838import { isHTTPS , isLocalhost } from '@/features/app/utils' ;
3939import { serializerCellValueHtml , serializerHtml } from '@/features/app/utils/clipboard' ;
4040import { tableConfig } from '@/features/i18n/table.config' ;
@@ -48,6 +48,7 @@ import {
4848 textPasteHandlerWithData ,
4949} from '../utils/copyAndPaste' ;
5050import { getSyncCopyData } from '../utils/getSyncCopyData' ;
51+ import { buildSelectionViewQuery } from '../utils/selectionViewQuery' ;
5152import { useSyncSelectionStore } from './useSelectionStore' ;
5253
5354const clearToastId = 'clearToastId' ;
@@ -79,13 +80,17 @@ export const useSelectionOperation = (props?: {
7980 const { t } = useTranslation ( tableConfig . i18nNamespaces ) ;
8081
8182 const groupBy = view ?. group ;
83+ const selectionViewQuery = useMemo (
84+ ( ) => buildSelectionViewQuery ( { view, personalViewCommonQuery } ) ,
85+ [ view , personalViewCommonQuery ]
86+ ) ;
8287
8388 const { mutateAsync : defaultCopyReq } = useMutation ( {
8489 mutationFn : async ( copyRo : IRangesRo ) => {
8590 const { collapsedGroupIds : _originalCollapsedGroupIds , ...rest } = copyRo ;
8691 const params = {
8792 ...rest ,
88- ...personalViewCommonQuery ,
93+ ...selectionViewQuery ,
8994 viewId,
9095 groupBy,
9196 search,
@@ -105,7 +110,7 @@ export const useSelectionOperation = (props?: {
105110 mutationFn : ( pasteRo : IPasteRo ) =>
106111 paste ( tableId ! , {
107112 ...pasteRo ,
108- ...personalViewCommonQuery ,
113+ ...selectionViewQuery ,
109114 viewId,
110115 groupBy,
111116 collapsedGroupIds,
@@ -118,14 +123,14 @@ export const useSelectionOperation = (props?: {
118123
119124 const { mutateAsync : temporaryPasteReq } = useMutation ( {
120125 mutationFn : ( temporaryPasteRo : ITemporaryPasteRo ) =>
121- temporaryPaste ( tableId ! , { ...temporaryPasteRo , ...personalViewCommonQuery , viewId } ) ,
126+ temporaryPaste ( tableId ! , { ...temporaryPasteRo , ...selectionViewQuery , viewId } ) ,
122127 } ) ;
123128
124129 const { mutateAsync : clearReq } = useMutation ( {
125130 mutationFn : ( clearRo : IRangesRo ) =>
126131 clear ( tableId ! , {
127132 ...clearRo ,
128- ...personalViewCommonQuery ,
133+ ...selectionViewQuery ,
129134 viewId,
130135 groupBy,
131136 collapsedGroupIds,
@@ -141,7 +146,7 @@ export const useSelectionOperation = (props?: {
141146 const { collapsedGroupIds : _originalCollapsedGroupIds , ...rest } = deleteRo ;
142147 const params = {
143148 ...rest ,
144- ...personalViewCommonQuery ,
149+ ...selectionViewQuery ,
145150 viewId,
146151 groupBy,
147152 search,
0 commit comments