Explore: Avoid duplicate refIds when adding a new query (#67499)

This commit is contained in:
Giordano Ricci
2023-04-28 15:01:50 +01:00
committed by GitHub
parent 932136807b
commit 15363e416b
2 changed files with 7 additions and 1 deletions

View File

@@ -275,7 +275,7 @@ export async function generateEmptyQuery(
defaultQuery = datasourceInstance.getDefaultQuery?.(CoreApp.Explore);
}
return { refId: getNextRefIdChar(queries), key: generateKey(index), datasource: datasourceRef, ...defaultQuery };
return { ...defaultQuery, refId: getNextRefIdChar(queries), key: generateKey(index), datasource: datasourceRef };
}
export const generateNewKeyAndAddRefIdIfMissing = (target: DataQuery, queries: DataQuery[], index = 0): DataQuery => {