Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Dec 22, 2023
1 parent c76c87e commit 165c3cd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,7 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({
onSupportedFieldFilter,
onSelectedFieldFilter,
onOverrideFieldGroupDetails,
getNewFieldsBySpec: (spec, dataView) => {
return spec.reduce((result: IndexPatternField[], fieldSpec: FieldSpec) => {
const field = new DataViewField(fieldSpec);
if (isFieldLensCompatible(field)) {
result.push(buildIndexPatternField(field, dataView));
}
return result;
}, []);
},
getNewFieldsBySpec,
});

const closeFieldEditor = useRef<() => void | undefined>();
Expand Down Expand Up @@ -428,4 +420,14 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({
);
};

function getNewFieldsBySpec(spec: FieldSpec[], dataView: DataView | null) {
return spec.reduce((result: IndexPatternField[], fieldSpec: FieldSpec) => {
const field = new DataViewField(fieldSpec);
if (isFieldLensCompatible(field)) {
result.push(buildIndexPatternField(field, dataView));
}
return result;
}, []);
}

export const MemoizedDataPanel = memo(InnerFormBasedDataPanel);

0 comments on commit 165c3cd

Please sign in to comment.