@@ -500,15 +500,18 @@ export const HadronElement: React.FunctionComponent<{
500500 collapse,
501501 } = useHadronElement ( element ) ;
502502
503+ const queryFilter = query ?. filter ;
504+
503505 // Function to check if a field is in the query
506+ // TODO: COMPASS-9541 Improve the functionality when checking for nested objects.
504507 const isFieldInQuery = useCallback (
505508 ( field : string , fieldValue : unknown ) : boolean => {
506509 return hasDistinctValue (
507- query ?. filter ?. [ field ] as Record < string , unknown > ,
510+ queryFilter ?. [ field ] as Record < string , unknown > ,
508511 fieldValue
509512 ) ;
510513 } ,
511- [ query ]
514+ [ queryFilter ]
512515 ) ;
513516
514517 // Add context menu hook for the field
@@ -733,7 +736,7 @@ export const HadronElement: React.FunctionComponent<{
733736 // double-clicked on a field and so auto focusing the input is
734737 // expected in this case
735738 // eslint-disable-next-line jsx-a11y/no-autofocus
736- autoFocus = { autoFocus ?. id === id && autoFocus . type === 'key' }
739+ autoFocus = { autoFocus ?. id === id && autoFocus ? .type === 'key' }
737740 editing = { editingEnabled }
738741 onEditStart = { ( ) => {
739742 onEditStart ?.( element . uuid , 'key' ) ;
@@ -772,7 +775,7 @@ export const HadronElement: React.FunctionComponent<{
772775 } }
773776 // See above
774777 // eslint-disable-next-line jsx-a11y/no-autofocus
775- autoFocus = { autoFocus ?. id === id && autoFocus . type === 'value' }
778+ autoFocus = { autoFocus ?. id === id && autoFocus ? .type === 'value' }
776779 editing = { editingEnabled }
777780 onEditStart = { ( ) => {
778781 onEditStart ?.( element . uuid , 'value' ) ;
@@ -814,7 +817,7 @@ export const HadronElement: React.FunctionComponent<{
814817 type = { type . value }
815818 // See above
816819 // eslint-disable-next-line jsx-a11y/no-autofocus
817- autoFocus = { autoFocus ?. id === id && autoFocus . type === 'type' }
820+ autoFocus = { autoFocus ?. id === id && autoFocus ? .type === 'type' }
818821 onChange = { ( newType ) => {
819822 type . change ( newType ) ;
820823
@@ -830,7 +833,7 @@ export const HadronElement: React.FunctionComponent<{
830833 </ div >
831834 { expandable && expanded && (
832835 < >
833- { visibleChildren . map ( ( el , idx ) => {
836+ { visibleChildren . map ( ( el : HadronElementType , idx : React . Key ) => {
834837 return (
835838 < HadronElement
836839 key = { idx }
0 commit comments