Skip to content

Commit b6789f5

Browse files
author
Dmitry Yadrikhinsky
committed
[TaskList] Checked fix
1 parent 5234309 commit b6789f5

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/screens/Main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
2-
import { Layout, Menu } from 'antd';
32
import { Route, Switch, Link } from 'react-router-dom';
4-
import Projects from './projects/Projects';
3+
import { Layout, Menu } from 'antd';
54
import { observer } from 'mobx-react';
5+
import Projects from './projects/Projects';
66

77
const { Header } = Layout;
88

src/screens/projects/Projects.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react';
22
import { Button, Layout, Space } from 'antd';
33
import { observer } from 'mobx-react';
4+
import { useHistory } from 'react-router-dom';
45

56
import TaskInput from './components/TaskInput';
67
import rootStore from '../../services/RootStore';
@@ -24,12 +25,9 @@ const TaskList = TreeList(
2425
checkable: true,
2526
onCheck(keys) {
2627
tasksStore.checkTasks(keys as string[]);
27-
console.log('Check', keys);
2828
},
29-
getDefaultChecked() {
30-
const taskKeys = tasksStore.getCheckedKeys(projectStore.activeProject);
31-
console.log('Checked List', taskKeys);
32-
return taskKeys;
29+
getCheckedKeys() {
30+
return tasksStore.getCheckedKeys(projectStore.activeProject);
3331
},
3432
}
3533
);

src/screens/projects/components/TreeList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function TreeList<T extends ITreeItem>(
1616
options?: {
1717
checkable?: boolean;
1818
onCheck?: (checkedKeys: React.Key[]) => void;
19-
getDefaultChecked?: () => React.Key[];
19+
getCheckedKeys?: () => React.Key[];
2020
}
2121
) {
2222
return observer(function TreeList({ onSelect }: TreeListProps) {
@@ -92,7 +92,7 @@ export default function TreeList<T extends ITreeItem>(
9292
return (
9393
<Tree
9494
className="draggable-tree"
95-
defaultCheckedKeys={options?.getDefaultChecked?.()}
95+
checkedKeys={options?.getCheckedKeys?.()}
9696
checkable={options?.checkable}
9797
draggable
9898
blockNode

0 commit comments

Comments
 (0)