fix: can't properly drag and drop in empty record group (#9039)
Fix #8968 Fix issue with drag and drop when record group are empty. Happy to discuss the implementation, as it's limited to the `@hello-pangea/dnd` api. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,14 +1,6 @@
|
||||
import React, { Ref, RefCallback } from 'react';
|
||||
import { isFunction } from '@sniptt/guards';
|
||||
import { Ref, RefCallback } from 'react';
|
||||
import { combineRefs } from '~/utils/combineRefs';
|
||||
|
||||
export const useCombinedRefs =
|
||||
<T>(...refs: (Ref<T> | undefined)[]): RefCallback<T> =>
|
||||
(node: T) => {
|
||||
for (const ref of refs) {
|
||||
if (isFunction(ref)) {
|
||||
ref(node);
|
||||
} else if (ref !== null && ref !== undefined) {
|
||||
(ref as React.MutableRefObject<T | null>).current = node;
|
||||
}
|
||||
}
|
||||
};
|
||||
export const useCombinedRefs = <T>(
|
||||
...refs: (Ref<T> | undefined)[]
|
||||
): RefCallback<T> => combineRefs<T>(...refs);
|
||||
|
||||
Reference in New Issue
Block a user