Skip to content

Commit

Permalink
Fixed a bug, which prevented some filtering to be triggered. Fixed a …
Browse files Browse the repository at this point in the history
…bug, which triggered content to be rendered twice.
  • Loading branch information
ransome1 committed Feb 25, 2024
1 parent 645d5f3 commit 73184a7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"webpack-merge": "^5.9.0"
},
"build": {
"buildVersion": "39",
"buildVersion": "41",
"asar": true,
"asarUnpack": "**\\*.{node,dll}",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.10",
"version": "2.0.11",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__mock__/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
x (C) 2025-12-08 2023-12-01 test2 +testProject1 @testContext due:2023-01-01
(A) 2023-06-24 test3 +testProject6 @testContext6 due:2023-12-03
(C) 2025-12-06 test3 +testProject3 @testContext due:2023-01-03
(C) 2025-12-05 test3 +testProject2 @testContext due:2023-01-05
(C) 2025-12-05 test3 +testProject2 @testContext due:2025-01-05
(C) 2025-12-07 test3 +testProject4 @testContext due:2023-01-04
4 changes: 4 additions & 0 deletions src/main/modules/Filters/Filters.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
function applyFilters(todoObjects: TodoObject[], filters: Filters | null): TodoObject[] {
return todoObjects.map((todoObject: TodoObject) => {
if (!todoObject.visible) {
return todoObject;
}

const isVisible = Object.entries(filters || {}).every(([key, filterArray]: [string, Filter[]]) => {
if (filterArray.length === 0) {
return true;
Expand Down
4 changes: 3 additions & 1 deletion src/main/modules/ProcessDataRequest/ProcessDataRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ async function processDataRequest(search?: string): Promise<void> {
const fileContent = await readFileContent(activeFile.todoFilePath, activeFile.todoFileBookmark);
let todoObjects: TodoObject[] | [] = await createTodoObjects(fileContent);
todoObjects = handleTodoObjectsDates(todoObjects);
todoObjects = handleCompletedTodoObjects(todoObjects);
todoObjects = handleCompletedTodoObjects(todoObjects);

updateAttributes(todoObjects, sorting, true);

if(!showHidden) todoObjects = handleHiddenTodoObjects(todoObjects);

if(filters) todoObjects = applyFilters(todoObjects, filters);

if(searchString) todoObjects = applySearchString(searchString, todoObjects);

updateAttributes(todoObjects, sorting, false);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const App = () => {
const [snackBarContent, setSnackBarContent] = useState<string | null>(null);
const [snackBarSeverity, setSnackBarSeverity] = useState<AlertColor | undefined>();
const [dialogOpen, setDialogOpen] = useState<boolean>(false);
const [searchString, setSearchString] = useState<string>('');
const [searchString, setSearchString] = useState<string | null>(null);
const [todoObjects, setTodoObjects] = useState<TodoObject[] | null>(null);
const [todoObject, setTodoObject] = useState<TodoObject | null>(null);
const [attributeFields, setAttributeFields] = useState<TodoObject | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Header/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const SearchComponent: React.FC<SearchComponentProps> = memo(({
freeSolo
autoHighlight
open={isAutocompleteOpen}
inputValue={searchString}
inputValue={searchString || ''}
options={searchFilters}
onBlur={() => setIsAutocompleteOpen(false)}
filterOptions={filterOptions}
Expand Down

0 comments on commit 73184a7

Please sign in to comment.