@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.umd.js CHANGED
@@ -10852,11 +10852,19 @@
10852
10852
  };
10853
10853
  backendCollections.forEach(markAsEditable);
10854
10854
  const result = core.joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
10855
- result.sort((a, b) => baseCollections.findIndex((c) => c.id === a.id) - baseCollections.findIndex((c) => c.id === b.id));
10856
- console.debug("Collections result", {
10857
- baseCollections,
10858
- backendCollections,
10859
- result
10855
+ result.sort((a, b) => {
10856
+ const indexA = baseCollections.findIndex((c) => c.id === a.id);
10857
+ const indexB = baseCollections.findIndex((c) => c.id === b.id);
10858
+ if (indexA === -1 && indexB === -1) {
10859
+ return 0;
10860
+ }
10861
+ if (indexA === -1) {
10862
+ return 1;
10863
+ }
10864
+ if (indexB === -1) {
10865
+ return -1;
10866
+ }
10867
+ return indexA - indexB;
10860
10868
  });
10861
10869
  return result;
10862
10870
  };