Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrap groupBy single-select value in an array #1000

Merged
merged 6 commits into from
Dec 13, 2024

Conversation

joannaWebDev
Copy link
Contributor

When trying to use the Single select in db-o11y, realized we were sending incorrect data format.

"error": "json: cannot unmarshal string into Go struct field internalQueryModel.groupByKeys of type []string",

In this PR I'm wrapping the value in an array.

@joannaWebDev joannaWebDev self-assigned this Dec 13, 2024
@joannaWebDev joannaWebDev removed the request for review from Sergej-Vlasov December 13, 2024 09:47
Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

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

question

packages/scenes/src/variables/groupby/GroupByVariable.tsx Outdated Show resolved Hide resolved
@@ -340,9 +340,9 @@ export function GroupByVariableRenderer({ model }: SceneComponentProps<MultiValu
}
return;
}
if (newValue?.value) {
if (newValue?.value && newValue?.label) {
Copy link
Contributor

Choose a reason for hiding this comment

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

don't think you want this extra condition. label is optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to avoid the !
Screenshot 2024-12-13 at 11 23 24 AM

  }
        if (newValue?.value) {
          setUncommittedValue([newValue]);
          model.changeValueTo([newValue.value], [newValue.label!]);
        }

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe something like:

        if (newValue?.value) {
          setUncommittedValue([newValue]);
          model.changeValueTo([newValue.value], newValue.label ? [newValue.label] : undefined);
        }

would work then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@joannaWebDev joannaWebDev merged commit 3958245 into main Dec 13, 2024
5 checks passed
@joannaWebDev joannaWebDev deleted the joannaWebDev/fix-groupBy-single branch December 13, 2024 11:03
@scenes-repo-bot-access-token
Copy link

🚀 PR was released in v5.33.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants