File tree Expand file tree Collapse file tree 6 files changed +10
-10
lines changed
apps/demos/Demos/CardView Expand file tree Collapse file tree 6 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ interface EmployeeProps {
88}
99
1010const 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
1919export default EmployeeComponent ;
Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ interface PriorityProps {
77}
88
99const 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} ;
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ import { employees } from './data.js';
33
44const 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} ;
88export default EmployeeComponent ;
Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ import { priorities } from './data.js';
44const 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} ;
Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff 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 < >
You can’t perform that action at this time.
0 commit comments