fix: tag order

This commit is contained in:
hamster1963 2024-10-02 23:49:16 +08:00
parent 745b88e849
commit 58dc3e8e32

View File

@ -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