message: fix: Fix `Composite` infinite loop on Firefox
  Closes
diff: @@ -6,20 +6,31 @@ type Item = {
  };
  export function sortBasedOnDOMPosition<T extends Item>(items: T[]): T[] {
  - const copy = items.slice();
  + const pairs = items.map((item, index) => [index, item] as const);
  +
  let isOrderDifferent = false;
  - copy.sort((a, b) => {
  +
  + pairs.sort(([indexA, a], [indexB, b]) => {
  const elementA = a.ref.current;
  const elementB = b.ref.current;
  if (!elementA || !elementB) return 0;
  + // a before b
  if (isElementPreceding(elementA, elementB)) {
  + if (indexA > indexB) {
  isOrderDifferent = true;
  + }
  return -1;
  }
  + // a after b
  + if (indexA < indexB) {
  + isOrderDifferent = true;
  + }
  return 1;
  });
  +
  if (isOrderDifferent) {
  - return copy;
  + return pairs.map(([_, item]) => item);
  }
  +
  return items;
  }
  