From 65d0cd369fd3b3fe1719f0c57aac446baa7ececa Mon Sep 17 00:00:00 2001 From: Brian Cao Date: Tue, 25 Oct 2022 16:22:15 -0700 Subject: [PATCH] fix sort on dashboard --- components/pages/DashboardEdit.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/pages/DashboardEdit.js b/components/pages/DashboardEdit.js index 38b1d7d632..0cc6d4e76a 100644 --- a/components/pages/DashboardEdit.js +++ b/components/pages/DashboardEdit.js @@ -24,7 +24,7 @@ export default function DashboardEdit({ websites }) { const ordered = useMemo( () => websites - .map(website => ({ ...website, order: order.indexOf(website.websiteId) })) + .map(website => ({ ...website, order: order.indexOf(website.websiteUuid) })) .sort(firstBy('order')), [websites, order], ); @@ -36,7 +36,7 @@ export default function DashboardEdit({ websites }) { const [removed] = orderedWebsites.splice(source.index, 1); orderedWebsites.splice(destination.index, 0, removed); - setOrder(orderedWebsites.map(website => website?.websiteId || 0)); + setOrder(orderedWebsites.map(website => website?.websiteUuid || 0)); } function handleSave() { @@ -76,8 +76,12 @@ export default function DashboardEdit({ websites }) { ref={provided.innerRef} style={{ marginBottom: snapshot.isDraggingOver ? 260 : null }} > - {ordered.map(({ websiteId, name, domain }, index) => ( - + {ordered.map(({ websiteUuid, name, domain }, index) => ( + {(provided, snapshot) => (