Fix: plugin loader cache not matching on decoupled plugin paths (#108529)

* fix(plugins): match decoupled plugin path in fe plugin loader cache

* chore(devenv): update local_cdn to work with latest changes in core

* refactor(plugins): improve legibility by splitting regexs into two

* revert(devenv): revert -oss removal in local_cdn rewrite path
This commit is contained in:
Jack Westbrook
2025-07-24 11:53:30 +02:00
committed by GitHub
parent e3a2cd5482
commit 5be9aa367b
2 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -19,6 +19,6 @@ server {
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
rewrite ^/grafana-oss/11.4.0-pre/public(.*)$ $1 last;
rewrite ^/grafana-oss/12.1.0-pre/public(.*)$ $1 last;
}
}
+14 -1
View File
@@ -54,7 +54,20 @@ export function getPluginFromCache(path: string): CachedPlugin | undefined {
export function extractCacheKeyFromPath(path: string) {
const regex = /\/?public\/plugins\/([^\/]+)\//;
const match = path.match(regex);
return match ? match[1] : null;
if (match) {
return match[1];
}
// Decoupled core plugins can be loaded by alternative paths
const decoupledPluginRegex = /\/?public\/app\/plugins\/(?:datasource|panel)\/([^\/]+)\//;
const decoupledPluginMatch = path.match(decoupledPluginRegex);
if (decoupledPluginMatch) {
return decoupledPluginMatch[1];
}
return null;
}
function getCacheKey(address: string): string | undefined {