Skip to content

Commit f95df73

Browse files
authored
[TSVB] Fields lists do not populate all the times (#85530) (#85751)
1 parent d1b13c5 commit f95df73

File tree

1 file changed

+17
-21
lines changed
  • src/plugins/vis_type_timeseries/public/application/components

1 file changed

+17
-21
lines changed

src/plugins/vis_type_timeseries/public/application/components/vis_editor.js

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,26 @@ export class VisEditor extends Component {
7474
this.props.eventEmitter.emit('dirtyStateChange', {
7575
isDirty: false,
7676
});
77+
78+
const extractedIndexPatterns = extractIndexPatterns(this.state.model);
79+
if (!isEqual(this.state.extractedIndexPatterns, extractedIndexPatterns)) {
80+
this.abortableFetchFields(extractedIndexPatterns).then((visFields) => {
81+
this.setState({
82+
visFields,
83+
extractedIndexPatterns,
84+
});
85+
});
86+
}
7787
}, VIS_STATE_DEBOUNCE_DELAY);
7888

79-
debouncedFetchFields = debounce(
80-
(extractedIndexPatterns) => {
81-
if (this.abortControllerFetchFields) {
82-
this.abortControllerFetchFields.abort();
83-
}
84-
this.abortControllerFetchFields = new AbortController();
89+
abortableFetchFields = (extractedIndexPatterns) => {
90+
if (this.abortControllerFetchFields) {
91+
this.abortControllerFetchFields.abort();
92+
}
93+
this.abortControllerFetchFields = new AbortController();
8594

86-
return fetchFields(extractedIndexPatterns, this.abortControllerFetchFields.signal);
87-
},
88-
VIS_STATE_DEBOUNCE_DELAY,
89-
{ leading: true }
90-
);
95+
return fetchFields(extractedIndexPatterns, this.abortControllerFetchFields.signal);
96+
};
9197

9298
handleChange = (partialModel) => {
9399
if (isEmpty(partialModel)) {
@@ -105,16 +111,6 @@ export class VisEditor extends Component {
105111
dirty = false;
106112
}
107113

108-
const extractedIndexPatterns = extractIndexPatterns(nextModel);
109-
if (!isEqual(this.state.extractedIndexPatterns, extractedIndexPatterns)) {
110-
this.debouncedFetchFields(extractedIndexPatterns).then((visFields) =>
111-
this.setState({
112-
visFields,
113-
extractedIndexPatterns,
114-
})
115-
);
116-
}
117-
118114
this.setState({
119115
dirty,
120116
model: nextModel,

0 commit comments

Comments
 (0)