Skip to content

Commit 63df994

Browse files
committed
Demos: review fix
1 parent ac3d9cb commit 63df994

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

apps/demos/Demos/CardView/FieldTemplate/React/Employee.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ interface EmployeeProps {
88
}
99

1010
const EmployeeComponent = ({ employeeID }: EmployeeProps) => {
11-
const employee = useMemo<Employee>(
11+
const employee = useMemo<Employee | undefined>(
1212
() => employees.find((e: Employee) => e.ID === employeeID),
1313
[employeeID]
1414
);
1515

16-
return <button className='task__link-button'>{ employee.Name }</button>;
16+
return <button className='task__link-button'>{ employee?.Name }</button>;
1717
};
1818

1919
export default EmployeeComponent;

apps/demos/Demos/CardView/FieldTemplate/React/Priority.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ interface PriorityProps {
77
}
88

99
const PriorityComponent = ({ priorityID }: PriorityProps) => {
10-
const priority = useMemo<Priority>(
10+
const priority = useMemo<Priority | undefined>(
1111
() => priorities.find((p: Priority) => p.id === priorityID),
1212
[priorityID]
1313
);
1414

1515
return (
16-
<div className={`task__priority task__priority--${priority.postfix}`}>
16+
<div className={`task__priority task__priority--${priority?.postfix}`}>
1717
<div className="task__indicator" />
18-
<div>{ priority.text }</div>
18+
<div>{ priority?.text }</div>
1919
</div>
2020
);
2121
};

apps/demos/Demos/CardView/FieldTemplate/ReactJs/Employee.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { employees } from './data.js';
33

44
const EmployeeComponent = ({ employeeID }) => {
55
const employee = useMemo(() => employees.find((e) => e.ID === employeeID), [employeeID]);
6-
return <button className="task__link-button">{employee.Name}</button>;
6+
return <button className="task__link-button">{employee?.Name}</button>;
77
};
88
export default EmployeeComponent;

apps/demos/Demos/CardView/FieldTemplate/ReactJs/Priority.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { priorities } from './data.js';
44
const PriorityComponent = ({ priorityID }) => {
55
const priority = useMemo(() => priorities.find((p) => p.id === priorityID), [priorityID]);
66
return (
7-
<div className={`task__priority task__priority--${priority.postfix}`}>
7+
<div className={`task__priority task__priority--${priority?.postfix}`}>
88
<div className="task__indicator" />
9-
<div>{priority.text}</div>
9+
<div>{priority?.text}</div>
1010
</div>
1111
);
1212
};

apps/demos/Demos/CardView/Selection/React/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const App = () => {
3232

3333
const onSelectionModeChange = useCallback((value: SingleOrMultiple) => {
3434
setSelectionMode(value);
35-
cardViewRef.current.instance().clearSelection();
35+
cardViewRef.current?.instance().clearSelection();
3636
}, []);
3737

3838
return (

apps/demos/Demos/CardView/Selection/ReactJs/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const App = () => {
2121
const cardViewRef = useRef(null);
2222
const onSelectionModeChange = useCallback((value) => {
2323
setSelectionMode(value);
24-
cardViewRef.current.instance().clearSelection();
24+
cardViewRef.current?.instance().clearSelection();
2525
}, []);
2626
return (
2727
<>

0 commit comments

Comments
 (0)