mirror of https://github.com/grafana/grafana.git
Scopes: Remove a rule of hooks warning from scopes (#112103)
This commit is contained in:
parent
8f54a15d8b
commit
2cbf2c071a
|
@ -1856,11 +1856,6 @@
|
|||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/features/commandPalette/actions/recentScopesActions.ts": {
|
||||
"react-hooks/rules-of-hooks": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/features/commandPalette/actions/scopeActions.tsx": {
|
||||
"react-hooks/rules-of-hooks": {
|
||||
"count": 4
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useScopesServices } from 'app/features/scopes/ScopesContextProvider';
|
|||
import { CommandPaletteAction } from '../types';
|
||||
import { RECENT_SCOPES_PRIORITY } from '../values';
|
||||
|
||||
export function getRecentScopesActions(): CommandPaletteAction[] {
|
||||
export function useRecentScopesActions(): CommandPaletteAction[] {
|
||||
const services = useScopesServices();
|
||||
|
||||
if (!(config.featureToggles.scopeFilters && services)) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import { config } from '@grafana/runtime';
|
|||
import { ScopesRow } from '../ScopesRow';
|
||||
import { CommandPaletteAction } from '../types';
|
||||
|
||||
import { getRecentScopesActions } from './recentScopesActions';
|
||||
import { useRecentScopesActions } from './recentScopesActions';
|
||||
import {
|
||||
getScopesParentAction,
|
||||
mapScopeNodeToAction,
|
||||
|
@ -16,7 +16,7 @@ import {
|
|||
} from './scopesUtils';
|
||||
|
||||
export function useRegisterRecentScopesActions() {
|
||||
const recentScopesActions = getRecentScopesActions();
|
||||
const recentScopesActions = useRecentScopesActions();
|
||||
useRegisterActions(recentScopesActions, [recentScopesActions]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue