Campaign drag reorder: fix sort in fetchDetails path
fetchDetails (db active path) sorted by createdAt, ignored order field. Drag persisted but UI didn't re-sort. Now both paths sort by order (fallback createdAt).
This commit is contained in:
+5
-1
@@ -2377,8 +2377,12 @@ function AdminView({ userId }) {
|
||||
})
|
||||
);
|
||||
|
||||
// newest first by createdAt (fallback to name for stable order).
|
||||
// sort by order field (fallback createdAt)
|
||||
detailedCampaigns.sort((a, b) => {
|
||||
const ao = a.order ?? null, bo = b.order ?? null;
|
||||
if (ao !== null && bo !== null) return ao - bo;
|
||||
if (ao !== null) return -1;
|
||||
if (bo !== null) return 1;
|
||||
const at = a.createdAt || 0;
|
||||
const bt = b.createdAt || 0;
|
||||
if (at === bt) return (a.name || '').localeCompare(b.name || '');
|
||||
|
||||
Reference in New Issue
Block a user