Skip to content

The open alternative to Salesforce, designed for AI.

599 B
Raw Blame
import { isDefined } from 'twenty-shared/utils';

import { acknowledgedNativeEditSequenceByRemoteElement } from '@/remote/elements/states/acknowledgedNativeEditSequenceByRemoteElement';

export const isNativeEditAcknowledged = ({
  remoteElement,
  nativeEditSequence,
}: {
  remoteElement: object;
  nativeEditSequence: number;
}): boolean => {
  const acknowledgedNativeEditSequence =
    acknowledgedNativeEditSequenceByRemoteElement.get(remoteElement);

  if (!isDefined(acknowledgedNativeEditSequence)) {
    return false;
  }

  return nativeEditSequence <= acknowledgedNativeEditSequence;
};