Scopes: Remove a rule of hooks warning from scopes (#112103)

This commit is contained in:
Tom Ratcliffe 2025-10-07 12:14:36 +01:00 committed by GitHub
parent 8f54a15d8b
commit 2cbf2c071a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 8 deletions

View File

@ -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

View File

@ -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)) {

View File

@ -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]);
}