mirror of https://github.com/buster-so/buster.git
Update SaveMetricToCollectionButton.tsx
This commit is contained in:
parent
41616d98b6
commit
7ffb8f1628
|
@ -7,6 +7,7 @@ import {
|
||||||
useRemoveMetricFromCollection,
|
useRemoveMetricFromCollection,
|
||||||
useSaveMetricToCollections
|
useSaveMetricToCollections
|
||||||
} from '@/api/buster_rest/metrics';
|
} from '@/api/buster_rest/metrics';
|
||||||
|
import uniq from 'lodash/uniq';
|
||||||
|
|
||||||
export const SaveMetricToCollectionButton: React.FC<{
|
export const SaveMetricToCollectionButton: React.FC<{
|
||||||
metricIds: string[];
|
metricIds: string[];
|
||||||
|
@ -29,7 +30,7 @@ export const SaveMetricToCollectionButton: React.FC<{
|
||||||
);
|
);
|
||||||
|
|
||||||
const onSaveToCollection = useMemoizedFn(async (collectionIds: string[]) => {
|
const onSaveToCollection = useMemoizedFn(async (collectionIds: string[]) => {
|
||||||
setSelectedCollections(collectionIds);
|
setSelectedCollections((prev) => uniq([...prev, ...collectionIds]));
|
||||||
await saveMetricToCollection({
|
await saveMetricToCollection({
|
||||||
metricIds,
|
metricIds,
|
||||||
collectionIds
|
collectionIds
|
||||||
|
|
Loading…
Reference in New Issue