fix type errors

This commit is contained in:
Ashley Harrison
2026-01-06 10:10:27 +00:00
parent 9ba65ab73f
commit ff7bab5753
7 changed files with 7 additions and 12 deletions
@@ -387,7 +387,7 @@ interface ListModeProps {
hasSearches: boolean;
canSave: boolean;
activeAction: ActiveAction;
saveButtonRef: React.RefObject<HTMLButtonElement>;
saveButtonRef: React.RefObject<HTMLButtonElement | null>;
isLoading: boolean;
onStartSave: () => void;
/** Callback to complete save. Throws ValidationError on validation failure. */
@@ -15,7 +15,7 @@ import { DashboardGridItem, RepeatDirection } from './DashboardGridItem';
interface PanelWrapperProps {
panel: VizPanel;
isLazy: boolean;
containerRef?: RefObject<HTMLDivElement>;
containerRef?: RefObject<HTMLDivElement | null>;
}
function PanelWrapper({ panel, isLazy, containerRef }: PanelWrapperProps) {
@@ -33,7 +33,7 @@ global.ResizeObserver = jest.fn().mockImplementation((callback) => {
});
// Helper function to assign a mock div to a ref
function assignMockDivToRef(ref: React.RefObject<HTMLDivElement>, mockDiv: HTMLDivElement) {
function assignMockDivToRef(ref: React.RefObject<HTMLDivElement | null>, mockDiv: HTMLDivElement) {
// Use type assertion to bypass readonly restriction in tests
(ref as { current: HTMLDivElement | null }).current = mockDiv;
}
@@ -8,7 +8,7 @@ import grafanaTextLogoDarkSvg from 'img/grafana_text_logo_dark.svg';
import grafanaTextLogoLightSvg from 'img/grafana_text_logo_light.svg';
interface SoloPanelPageLogoProps {
containerRef: React.RefObject<HTMLDivElement>;
containerRef: React.RefObject<HTMLDivElement | null>;
isHovered: boolean;
hideLogo?: UrlQueryValue;
}
@@ -44,7 +44,7 @@ export type QueryLibraryContextType = {
onUpdateSuccess?: () => void,
onSelectQuery?: (query: DataQuery) => void,
datasourceFilters?: string[],
parentRef?: React.RefObject<HTMLDivElement>
parentRef?: React.RefObject<HTMLDivElement | null>
) => ReactNode;
/**
@@ -60,12 +60,7 @@ export function VisualizationSuggestionCard({
content = (
<button {...commonButtonProps}>
{/* to use inert in React 18, we have to do this hacky object spread thing. https://stackoverflow.com/questions/72720469/error-when-using-inert-attribute-with-typescript */}
<div
style={innerStyles}
className={cx(styles.renderContainer, isSelected && styles.selectedSuggestion)}
{...{ inert: '' }}
>
<div style={innerStyles} className={cx(styles.renderContainer, isSelected && styles.selectedSuggestion)} inert>
<PanelRenderer
title=""
data={data}
@@ -613,7 +613,7 @@ function SavedQueryButtons(props: {
onUpdateSuccess?: () => void;
onSelectQuery: (query: DataQuery) => void;
datasourceFilters: string[];
parentRef: React.RefObject<HTMLDivElement>;
parentRef: React.RefObject<HTMLDivElement | null>;
}) {
const { renderSavedQueryButtons } = useQueryLibraryContext();
return renderSavedQueryButtons(