Improve upsert for spreadsheet import (#11283)
Refactor query runner to improve the import method for upserts, we now take into account any unique field and prevent any conflict upfront. Previously, we would only update if an `id` was passed. https://github.com/user-attachments/assets/8087b864-ba42-4b6e-abf2-b9ea66e6c467 This is only a first step, there are other things to fix on the frontend for this to work.
This commit is contained in:
@ -7,7 +7,7 @@ import {
|
||||
size,
|
||||
useFloating,
|
||||
} from '@floating-ui/react';
|
||||
import React, { useCallback, useRef, useState } from 'react';
|
||||
import React, { useCallback, useId, useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { AppTooltip, MenuItem, MenuItemSelect, SelectOption } from 'twenty-ui';
|
||||
import { ReadonlyDeep } from 'type-fest';
|
||||
@ -20,7 +20,6 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
|
||||
import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import { useUpdateEffect } from '~/hooks/useUpdateEffect';
|
||||
|
||||
const StyledFloatingDropdown = styled.div`
|
||||
@ -42,6 +41,7 @@ export const MatchColumnSelect = ({
|
||||
placeholder,
|
||||
}: MatchColumnSelectProps) => {
|
||||
const theme = useTheme();
|
||||
const idPrefix = useId();
|
||||
|
||||
const dropdownContainerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@ -138,8 +138,8 @@ export const MatchColumnSelect = ({
|
||||
/>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItemsContainer hasMaxHeight>
|
||||
{options?.map((option) => {
|
||||
const id = `${uuidV4()}-${option.value}`;
|
||||
{options?.map((option, index) => {
|
||||
const id = `${idPrefix}-option-${index}`;
|
||||
return (
|
||||
<React.Fragment key={id}>
|
||||
<div id={id}>
|
||||
|
||||
Reference in New Issue
Block a user