mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 04:22:02 +08:00
fix: Logs UI: querybuildersearch: avoid emptying out query on sourceKeys update if tags are yet to be populated (#4355)
* fix: querybuildersearch: do not call query onChange from sourceKeys useEffect if tags is empty * chore: add comment explaining change
This commit is contained in:
parent
be27a92fc9
commit
085cf34a49
@ -150,6 +150,20 @@ function QueryBuilderSearch({
|
|||||||
(item) => item.key as BaseAutocompleteData,
|
(item) => item.key as BaseAutocompleteData,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Avoid updating query with onChange at the bottom of this useEffect
|
||||||
|
// if there are no `tags` that need to be normalized after receiving
|
||||||
|
// the latest `sourceKeys`.
|
||||||
|
//
|
||||||
|
// Executing the following logic for empty tags leads to emptying
|
||||||
|
// out of `query` via `onChange`.
|
||||||
|
// `tags` can contain stale empty value while being updated by `useTag`
|
||||||
|
// which maintains it as a state and updates it via useEffect when props change.
|
||||||
|
// This was observed when pipeline filters were becoming empty after
|
||||||
|
// returning from logs explorer.
|
||||||
|
if ((tags?.length || 0) < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
initialTagFilters.items = tags.map((tag, index) => {
|
initialTagFilters.items = tags.map((tag, index) => {
|
||||||
const isJsonTrue = query.filters?.items[index]?.key?.isJSON;
|
const isJsonTrue = query.filters?.items[index]?.key?.isJSON;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user