@firecms/collection_editor 3.0.0-canary.249 → 3.0.0-canary.250

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -10848,11 +10848,19 @@ const mergeCollections = (baseCollections, backendCollections = [], modifyCollec
10848
10848
  };
10849
10849
  backendCollections.forEach(markAsEditable);
10850
10850
  const result = joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
10851
- result.sort((a, b) => baseCollections.findIndex((c2) => c2.id === a.id) - baseCollections.findIndex((c2) => c2.id === b.id));
10852
- console.debug("Collections result", {
10853
- baseCollections,
10854
- backendCollections,
10855
- result
10851
+ result.sort((a, b) => {
10852
+ const indexA = baseCollections.findIndex((c2) => c2.id === a.id);
10853
+ const indexB = baseCollections.findIndex((c2) => c2.id === b.id);
10854
+ if (indexA === -1 && indexB === -1) {
10855
+ return 0;
10856
+ }
10857
+ if (indexA === -1) {
10858
+ return 1;
10859
+ }
10860
+ if (indexB === -1) {
10861
+ return -1;
10862
+ }
10863
+ return indexA - indexB;
10856
10864
  });
10857
10865
  return result;
10858
10866
  };