Skip to content

Conversation

oscarkilhed
Copy link
Collaborator

@oscarkilhed oscarkilhed commented Aug 5, 2025

In order for variable.getValue text to properly work we need to pass in the field path. An example of this is the __dashboard macro in Grafana that has properties on it like __dashboard.title __dashboard.uuid.

📦 Published PR as canary version: 6.29.3--canary.1204.16750133031.0

✨ Test out this PR locally via:

npm install @grafana/[email protected]
npm install @grafana/[email protected]
# or 
yarn add @grafana/[email protected]
yarn add @grafana/[email protected]

formatter: (value, _args, variable, fieldPath) => {
if (variable.getValueText) {
return variable.getValueText();
return variable.getValueText(fieldPath);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a bug report for someone using text formatter with fieldPath?

this feels a but messy / wrong fix, the cleaner solutionn feels like it woudl be to pass in the value and text representation to the formatter, but feels a bit bad from a performance standpoint to always call getValue and getValueText

Copy link
Collaborator

@torkelo torkelo left a comment

Choose a reason for hiding this comment

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

I guess this is ok, would be nice with a unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Create a release when this pr is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants