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

QueryVariables not getting sorted #908

Open
davidfb opened this issue Sep 19, 2024 · 0 comments
Open

QueryVariables not getting sorted #908

davidfb opened this issue Sep 19, 2024 · 0 comments

Comments

@davidfb
Copy link

davidfb commented Sep 19, 2024

Function sortVariableValues in file scenes/packages/scenes/src/variables/variants/query/utils.ts seems unable to really sort variables.

It receives an options parameter typed as any[], although the real type options seem to be being passed as is VariableValueOption, as defined in the scenes/packages/scenes/src/variables/types.ts file:

export interface VariableValueOption {
  label: string;
  value: VariableValueSingle;
  group?: string;
}

Both sortByNumeric and sortByNaturalSort internal sort strategies defined inside the sortVariableValues function seem to try to sort options based on an attribute called text, but, as we can see, the VariableValueOption doesn't have any text attribute. It seems like sortByNumeric and sortByNaturalSort should be checking the label attribute instead. Is there any reason not to do that? Am I missunderstanding somehing?

Thank you.

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

No branches or pull requests

1 participant