From fc95f6dc6f752cc14e1cc781fe38389b8758b64f Mon Sep 17 00:00:00 2001 From: Evan Buss Date: Sun, 30 Jun 2024 20:49:30 -0400 Subject: [PATCH] fix: redux can't serialize a Set (#173) Use a plain object with unique keys Go style --- server/app/src/components/tables/BookTable.tsx | 2 +- server/app/src/components/tables/Facets.tsx | 2 +- server/app/src/state/api.ts | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/app/src/components/tables/BookTable.tsx b/server/app/src/components/tables/BookTable.tsx index efff738..f054c8d 100644 --- a/server/app/src/components/tables/BookTable.tsx +++ b/server/app/src/components/tables/BookTable.tsx @@ -29,7 +29,7 @@ export default function BookTable({ books }: BookTableProps) { ), cell: (props) => { - const online = servers && servers.has(props.getValue()); + const online = servers && servers[props.getValue()]; return ( ({ - getServers: builder.query, void>({ + getServers: builder.query, void>({ query: () => `servers`, transformResponse: (ircServers: IrcServer) => { - return new Set(ircServers.elevatedUsers ?? []); + return Object.fromEntries( + ircServers.elevatedUsers?.map((x) => [x, true]) ?? [] + ); } }), getBooks: builder.query({