From 58dc3e8e32ba634bc8b56b75eaa4c35054a44c06 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Wed, 2 Oct 2024 23:49:16 +0800 Subject: [PATCH] fix: tag order --- .../(main)/ClientComponents/ServerListClient.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/[locale]/(main)/ClientComponents/ServerListClient.tsx b/app/[locale]/(main)/ClientComponents/ServerListClient.tsx index 06c8d38..00e3594 100644 --- a/app/[locale]/(main)/ClientComponents/ServerListClient.tsx +++ b/app/[locale]/(main)/ClientComponents/ServerListClient.tsx @@ -30,12 +30,7 @@ export default function ServerListClient() { const { result } = data; - const allTag = result.map((server) => server.tag).filter((tag) => tag); - const uniqueTags = [...new Set(allTag)]; - uniqueTags.sort((a, b) => a.localeCompare(b)); - - uniqueTags.unshift(defaultTag); const sortedServers = result.sort((a, b) => { const displayIndexDiff = (b.display_index || 0) - (a.display_index || 0); @@ -43,6 +38,11 @@ export default function ServerListClient() { return a.id - b.id; }); + const allTag = sortedServers.map((server) => server.tag).filter((tag) => tag); + const uniqueTags = [...new Set(allTag)]; + + uniqueTags.unshift(defaultTag); + const filteredServers = tag === defaultTag ? sortedServers