Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Fix console warnings while executing tests with React 18 #16386

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,15 @@ GridHeaderFilterCell.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
isFilterActive: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,15 @@ GridHeaderFilterMenu.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
isFilterActive: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ GridHeaderFilterMenuContainer.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
isFilterActive: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ GridFilterInputBoolean.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ GridFilterInputDate.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@ GridFilterInputMultipleSingleSelect.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ GridFilterInputMultipleValue.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ GridFilterInputSingleSelect.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@ GridFilterInputValue.propTypes = {
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
current: (props, propName) => {
if (props[propName] == null) {
return null;
}
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
return new Error(`Expected prop '${propName}' to be of type Element`);
}
return null;
},
}),
]),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type GridFilterInputValueProps<
applyValue: (value: GridFilterItem) => void;
// Is any because if typed as GridApiRef a dep cycle occurs. Same happens if ApiContext is used.
apiRef: RefObject<Api>;
inputRef?: React.Ref<any>;
inputRef?: React.Ref<HTMLElement | null>;
focusElementRef?: React.Ref<any>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I do the same for focusElementRef?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it, but it requires a bit more changes than just this type, so I left it as any
if it is not super important, I would leave it for now

headerFilterMenu?: React.ReactNode;
clearButton?: React.ReactNode | null;
Expand Down