mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 05:46:28 +08:00
Plugins: Improve frontend loader cache (#87488)
* do it * set empty child version to parent version * feat(plugins): use pluginId for loader cache keys * feat(plugins): apply caching to all js and css files systemjs loads * remove old code and add comment * test(plugins): update systemjs hooks tests in line with better caching * test(plugins): wip - comment out failing backend loader tests * fix tests and improve comment * Update public/app/features/plugins/loader/cache.test.ts Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com> --------- Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"path"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/slugify"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
@ -144,14 +143,11 @@ func configureAppChildPlugin(parent *plugins.Plugin, child *plugins.Plugin) {
|
||||
return
|
||||
}
|
||||
child.IncludedInAppID = parent.ID
|
||||
child.BaseURL = parent.BaseURL
|
||||
|
||||
// TODO move this logic within assetpath package
|
||||
appSubPath := strings.ReplaceAll(strings.Replace(child.FS.Base(), parent.FS.Base(), "", 1), "\\", "/")
|
||||
if parent.IsCorePlugin() {
|
||||
child.Module = path.Join("core:plugin", parent.ID, appSubPath)
|
||||
} else {
|
||||
child.Module = path.Join("public/plugins", parent.ID, appSubPath, "module.js")
|
||||
// If the child plugin does not have a version, it will inherit the version from the parent.
|
||||
// This is to ensure that the frontend can appropriately cache the plugin assets.
|
||||
if child.Info.Version == "" {
|
||||
child.Info.Version = parent.Info.Version
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user