Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use fast deep equal instead lodash #54

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Before contributing please read the [contributing guidelines](./CONTRIBUTING.md)

## Supported operating systems
- Windows
- Linux

There are some issues with Linux and Mac but we shall work on these soon.

Bear in mind this is still in development and missing the following core features:
- Caching service (constant file watching to keep cache up to date) - only works when program is open
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@tauri-apps/api": "^1.3.0",
"@types/react-redux": "^7.1.25",
"autoprefixer": "^10.4.14",
"fast-deep-equal": "^3.1.3",
"postcss": "^8.4.24",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.1.1",
"tailwindcss": "^3.3.2",
"lodash": "^4.17.21"
"tailwindcss": "^3.3.2"
},
"devDependencies": {
"@tauri-apps/cli": "^1.3.1",
Expand Down
6 changes: 3 additions & 3 deletions src/state/slices/currentDirectorySlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createSlice } from "@reduxjs/toolkit";
import type { PayloadAction } from "@reduxjs/toolkit";
import {DirectoryContent} from "../../types";
import {RootState} from "../store";
import _ from "lodash";
import isEqual from "fast-deep-equal";

export interface CurrentDirectoryState {
contents: DirectoryContent[];
Expand All @@ -29,11 +29,11 @@ export const currentDirectorySlice = createSlice({
},
renameContent: (state, action: PayloadAction<[DirectoryContent, DirectoryContent]>) => {
const [oldContent, newContent] = action.payload;
state.contents = state.contents.filter(c => !_.isEqual(c, oldContent));
state.contents = state.contents.filter(c => !isEqual(c, oldContent));
state.contents = [newContent, ...state.contents];
},
deleteContent: (state, action: PayloadAction<DirectoryContent>) => {
state.contents = state.contents.filter(c => !_.isEqual(c, action.payload));
state.contents = state.contents.filter(c => !isEqual(c, action.payload));
}
}
})
Expand Down
Loading