{
+ if (el && !el.dataset.dynamicScroll) {
+ el.dataset.dynamicScroll = 'true';
+ setScrollContainer(el);
+ }
+ }}
+ onScroll={throttle(lazyScroll, 100)}
+ >
+
+ {Object.entries(fieldGroups)
+ .filter(([, { showInAccordion }]) => !showInAccordion)
+ .flatMap(([, { fields }]) =>
+ fields.map((field) => (
+
+ ))
+ )}
+
+ {Object.entries(fieldGroups)
+ .filter(([, { showInAccordion }]) => showInAccordion)
+ .map(([key, fieldGroup]) => (
+
+ {
+ setAccordionState((s) => ({
+ ...s,
+ [key]: open,
+ }));
+ const displayedFieldLength = getDisplayedFieldsLength(fieldGroups, {
+ ...accordionState,
+ [key]: open,
+ });
+ setPageSize(
+ Math.max(PAGINATION_SIZE, Math.min(pageSize * 1.5, displayedFieldLength))
+ );
+ }}
+ showExistenceFetchError={existenceFetchFailed}
+ renderCallout={
+
+ }
+ />
+
+
+ ))}
+
+
+ );
+}
diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx
index b0604efff7b8..7d1c80e5a7f6 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx
@@ -71,11 +71,19 @@ describe('Fields Accordion', () => {
paginatedFields: indexPattern.fields,
fieldProps,
renderCallout: