Plugins: Allow apps to expose components. Update the extensions API. (#87236)

* feat: introduce exposable components and update the public APIs

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* tests: fix the tests for `usePluginComponent()`

I broke them when I wrapped the component with the PluginContextProvider which fetches the plugin metadata.

* fix: typo

---------

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
Levente BaloghandMarcus Andersson authored and GitHub committed 2024-06-07 18:05:00 +02:00
1 parent 27a791db12
commit ebe42e1ada
17 files changed
+366 -38

No files matched your search

@@ -25,6 +25,11 @@ export type UsePluginExtensionsResult<T = PluginExtension> = {
isLoading: boolean;
};
export type UsePluginComponentResult<Props = {}> = {
component: React.ComponentType<Props> | undefined | null;
isLoading: boolean;
};
let singleton: GetPluginExtensions | undefined;
export function setPluginExtensionGetter(instance: GetPluginExtensions): void {