Skip to content

Commit

Permalink
feat(connections): make connections table sorting state persisted
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Sep 8, 2023
1 parent 4b498fa commit 6957cb4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/pages/Connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ export default () => {
])

const [grouping, setGrouping] = createSignal<GroupingState>([])
const [sorting, setSorting] = createSignal<SortingState>([
{ id: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime, desc: true },
])
const [sorting, setSorting] = makePersisted(
createSignal<SortingState>([
{ id: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime, desc: true },
]),
{ name: 'connectionsTableSorting', storage: localStorage },
)

const table = createSolidTable({
state: {
Expand Down Expand Up @@ -371,8 +374,9 @@ export default () => {
<td
onContextMenu={(e) => {
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() ? (
Expand Down

0 comments on commit 6957cb4

Please sign in to comment.