[v10.2.x] Tempo: Fix cache in TraceQL editor (#79471)

Tempo: Fix cache in TraceQL editor (#79468)

Fix 77380

(cherry picked from commit 70b980e47f)

Co-authored-by: Andre Pereira <adrapereira@gmail.com>
(cherry picked from commit cd3dbc81f7)
This commit is contained in:
grafana-delivery-bot[bot]
2023-12-21 20:38:20 +00:00
committed by Andreas Christou
parent 2bbd6699a7
commit 51cc8f6c3f
@@ -282,12 +282,13 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
private async getTagValues(tagName: string, query: string): Promise<Array<SelectableValue<string>>> {
let tagValues: Array<SelectableValue<string>>;
const cacheKey = `${tagName}:${query}`;
if (this.cachedValues.hasOwnProperty(tagName)) {
tagValues = this.cachedValues[tagName];
if (this.cachedValues.hasOwnProperty(cacheKey)) {
tagValues = this.cachedValues[cacheKey];
} else {
tagValues = await this.languageProvider.getOptionsV2(tagName, query);
this.cachedValues[tagName] = tagValues;
this.cachedValues[cacheKey] = tagValues;
}
return tagValues;
}