feat(connections): make connections table sorting state persisted

This commit is contained in:
kunish 2023-09-08 18:37:03 +08:00
parent 4b498fa022
commit 6957cb4ddf
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430

View File

@ -196,9 +196,12 @@ export default () => {
])
const [grouping, setGrouping] = createSignal<GroupingState>([])
const [sorting, setSorting] = createSignal<SortingState>([
const [sorting, setSorting] = makePersisted(
createSignal<SortingState>([
{ id: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime, desc: true },
])
]),
{ name: 'connectionsTableSorting', storage: localStorage },
)
const table = createSolidTable({
state: {
@ -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() ? (