mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Fix render performance and avoid re-rendering rows constantly
This commit is contained in:
@@ -7,6 +7,8 @@ export interface ServerFileStore {
|
||||
|
||||
setDirectory: Action<ServerFileStore, string>;
|
||||
setSelectedFiles: Action<ServerFileStore, string[]>;
|
||||
appendSelectedFile: Action<ServerFileStore, string>;
|
||||
removeSelectedFile: Action<ServerFileStore, string>;
|
||||
}
|
||||
|
||||
const files: ServerFileStore = {
|
||||
@@ -20,6 +22,14 @@ const files: ServerFileStore = {
|
||||
setSelectedFiles: action((state, payload) => {
|
||||
state.selectedFiles = payload;
|
||||
}),
|
||||
|
||||
appendSelectedFile: action((state, payload) => {
|
||||
state.selectedFiles = state.selectedFiles.filter(f => f !== payload).concat(payload);
|
||||
}),
|
||||
|
||||
removeSelectedFile: action((state, payload) => {
|
||||
state.selectedFiles = state.selectedFiles.filter(f => f !== payload);
|
||||
}),
|
||||
};
|
||||
|
||||
export default files;
|
||||
|
||||
Reference in New Issue
Block a user