Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

LabelFilters: Fix bug with running incomplete query #109

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

ivanahuckova
Copy link
Member

In LabelFilterItem we incorrectly assumed that the type of onChange is onChange: (value: Partial<QueryBuilderLabelFilter>) => void; and to fix types assertion, I defaulted to empty string. Which is incorrect and was causing updating of query after each part of label filter changed. But we want to update query only after all parts of label filter are updated.

Also correct type for OnChange in LabelFilterItem should be with Partial
image

@ivanahuckova ivanahuckova requested a review from matyax January 24, 2024 13:43
@ivanahuckova ivanahuckova self-assigned this Jan 24, 2024
@@ -14,7 +14,7 @@ interface Props {
defaultOp: string;
item: Partial<QueryBuilderLabelFilter>;
items: Array<Partial<QueryBuilderLabelFilter>>;
onChange: (value: QueryBuilderLabelFilter) => void;
onChange: (value: Partial<QueryBuilderLabelFilter>) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really see why it's Partial for all item, items, and onChange.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? Not sure I understand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see at the bottom we call onChange sometimes without value, and sometimes without value. Again not sure why, but that explains the partial.

@ivanahuckova ivanahuckova merged commit 96a0221 into main Jan 24, 2024
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants