Skip to content

Commit c62046e

Browse files
LukasTyarminmeh
authored andcommitted
Changes from ref react-ts-codemod
1 parent 4dc9d67 commit c62046e

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

packages/x-charts/src/context/ChartProvider/ChartProvider.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type ChartContextValue<
2525
/**
2626
* The ref to the <svg />.
2727
*/
28-
svgRef: React.RefObject<SVGSVGElement>;
28+
svgRef: React.RefObject<SVGSVGElement | null>;
2929
};
3030

3131
// export interface ChartProviderProps<TSignatures extends readonly ChartAnyPluginSignature[]> {

packages/x-charts/src/context/SizeProvider/Size.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface SizeContextState extends Required<Pick<SizeProviderProps, 'heig
1616
/**
1717
* The ref of the svg element that the chart is rendered in.
1818
*/
19-
svgRef: React.RefObject<SVGSVGElement>;
19+
svgRef: React.RefObject<SVGSVGElement | null>;
2020
/**
2121
* If the chart has a defined size.
2222
*/

packages/x-charts/src/hooks/useSvgRef.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as React from 'react';
33
import { useChartContext } from '../context/ChartProvider';
44

5-
export function useSvgRef(): React.RefObject<SVGSVGElement> {
5+
export function useSvgRef(): React.RefObject<SVGSVGElement | null> {
66
const context = useChartContext();
77

88
if (!context) {

packages/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,9 +1499,11 @@ describe('<DataGridPro /> - Row editing', () => {
14991499
}
15001500
}, [hasFocus, inputRef]);
15011501
return (
1502-
<Portal>
1503-
<input ref={(ref) => setInputRef(ref)} data-testid="input" />
1504-
</Portal>
1502+
(<Portal>
1503+
<input ref={ref => {
1504+
setInputRef(ref);
1505+
}} data-testid="input" />
1506+
</Portal>)
15051507
);
15061508
}
15071509
const renderEditCell = (props: GridRenderEditCellParams) => (

packages/x-tree-view/src/internals/TreeViewProvider/TreeViewProvider.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type TreeViewContextValue<
2424
instance: TreeViewInstance<TSignatures, TOptionalSignatures>;
2525
publicAPI: TreeViewPublicAPI<TSignatures, TOptionalSignatures>;
2626
store: TreeViewStore<TSignatures>;
27-
rootRef: React.RefObject<HTMLUListElement>;
27+
rootRef: React.RefObject<HTMLUListElement | null>;
2828
wrapItem: TreeItemWrapper<TSignatures>;
2929
wrapRoot: TreeRootWrapper;
3030
runItemPlugins: TreeViewItemPluginsRunner;

packages/x-tree-view/src/internals/hooks/useInstanceEventHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function createUseInstanceEventHandler(registryContainer: RegistryContain
4141
const subscription = React.useRef<(() => void) | null>(null);
4242
const handlerRef = React.useRef<
4343
TreeViewEventListener<TreeViewUsedEvents<Signature>[E]> | undefined
44-
>();
44+
>(undefined);
4545
handlerRef.current = handler;
4646
const cleanupTokenRef = React.useRef<UnregisterToken | null>(null);
4747

packages/x-tree-view/src/useTreeItem/useTreeItem.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export type UseTreeItemLabelInputSlotProps<ExternalProps = {}> = ExternalProps &
9696
UseTreeItemLabelInputSlotOwnProps;
9797

9898
export interface UseTreeItemCheckboxSlotOwnProps {
99-
ref: React.RefObject<HTMLButtonElement>;
99+
ref: React.RefObject<HTMLButtonElement | null>;
100100
}
101101

102102
export type UseTreeItemCheckboxSlotProps<ExternalProps = {}> = ExternalProps &

0 commit comments

Comments
 (0)