From 44c7f7836393c1b2315539c0e3ff0ec693ff0221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 10 Mar 2023 10:24:11 +0800 Subject: [PATCH] =?UTF-8?q?enhance(files):=E5=A2=9E=E5=8A=A0=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=AE=8C=E6=88=90=E6=8E=92=E5=BA=8F=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=E9=80=89=E6=8B=A9=E5=99=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/states/files.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/states/files.ts b/src/states/files.ts index 0092f22..6c8e3d7 100644 --- a/src/states/files.ts +++ b/src/states/files.ts @@ -1,5 +1,5 @@ import { convertFileSrc } from '@tauri-apps/api/tauri'; -import { addIndex, map, mergeLeft } from 'ramda'; +import { addIndex, map, mergeLeft, sort } from 'ramda'; import { FileItem } from '../models'; import { SyncObjectCallback } from '../types'; import { createStoreHook } from '../utils/store_creator'; @@ -36,3 +36,7 @@ export const useFileListStore = createStoreHook }); } })); + +export function sortedFilesSelector(): SyncObjectCallback { + return state => sort((fa, fb) => fa.sort - fb.sort, state.files); +}