{
+ 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 b0604efff7b89..7d1c80e5a7f6a 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: