From 6957cb4ddf9616ab6eade404098d4b84c9ed2a97 Mon Sep 17 00:00:00 2001 From: kunish Date: Fri, 8 Sep 2023 18:37:03 +0800 Subject: [PATCH] feat(connections): make connections table sorting state persisted --- src/pages/Connections.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/Connections.tsx b/src/pages/Connections.tsx index 5c5c4b2..58e63fe 100644 --- a/src/pages/Connections.tsx +++ b/src/pages/Connections.tsx @@ -196,9 +196,12 @@ export default () => { ]) const [grouping, setGrouping] = createSignal([]) - const [sorting, setSorting] = createSignal([ - { id: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime, desc: true }, - ]) + const [sorting, setSorting] = makePersisted( + createSignal([ + { id: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime, desc: true }, + ]), + { name: 'connectionsTableSorting', storage: localStorage }, + ) const table = createSolidTable({ state: { @@ -371,8 +374,9 @@ export default () => { { e.preventDefault() - typeof cell.renderValue() === 'string' && - void writeClipboard(cell.renderValue() as string) + + const value = cell.renderValue() as null | string + value && writeClipboard(value).catch(() => {}) }} > {cell.getIsGrouped() ? (