Fix render performance and avoid re-rendering rows constantly
This commit is contained in:
parent
325626e46d
commit
cb3288500a
3 changed files with 51 additions and 28 deletions
|
@ -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 a new issue