mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 10:20:29 -06:00
Plugin extensions: Return react components from usePluginComponents()
(#89237)
feat: return with react components from `usePluginComponents()`
This commit is contained in:
parent
0cc67bb93d
commit
1d6c9d4690
@ -41,12 +41,14 @@ export function usePluginLinks(options: GetPluginExtensionsOptions): {
|
||||
|
||||
export function usePluginComponents<Props = {}>(
|
||||
options: GetPluginExtensionsOptions
|
||||
): { components: Array<PluginExtensionComponent<Props>>; isLoading: boolean } {
|
||||
): { components: Array<React.ComponentType<Props>>; isLoading: boolean } {
|
||||
const { extensions, isLoading } = usePluginExtensions(options);
|
||||
|
||||
return useMemo(
|
||||
() => ({
|
||||
components: extensions.filter(isPluginExtensionComponent) as Array<PluginExtensionComponent<Props>>,
|
||||
components: extensions
|
||||
.filter(isPluginExtensionComponent)
|
||||
.map(({ component }) => component as React.ComponentType<Props>),
|
||||
isLoading,
|
||||
}),
|
||||
[extensions, isLoading]
|
||||
|
Loading…
Reference in New Issue
Block a user