Skip to content

Commit

Permalink
Improve Lens code preventing an endless loop of update
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Dec 15, 2023
1 parent 454592c commit 75cc235
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,14 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({
frame.dataViews.indexPatterns,
data.search.session,
]);

useEffect(() => {
if (hasNewFields) {
refreshFieldList();
}
}, [hasNewFields, refreshFieldList]);
// Preventing a race condition, making sure refreshFieldList is just executed once when hasNewFields is true
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [hasNewFields]);

const editField = useMemo(
() =>
Expand Down

0 comments on commit 75cc235

Please sign in to comment.