-
Notifications
You must be signed in to change notification settings - Fork 22
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
🐾 Update to PF5 - part II - handle rest of event handlers #1287
🐾 Update to PF5 - part II - handle rest of event handlers #1287
Conversation
@@ -57,7 +57,10 @@ export const AutocompleteFilter = ({ | |||
|
|||
const options = validSupported.map(({ label }) => <SelectOption key={label} value={label} />); | |||
|
|||
const onFilter = (_, textInput) => { | |||
const onFilter: ( | |||
e: React.ChangeEvent<HTMLInputElement> | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e: React.ChangeEvent<HTMLInputElement> | null, | |
event: React.ChangeEvent<HTMLInputElement> | null, |
@@ -350,6 +350,27 @@ export function StandardPage<T>({ | |||
.filter((field) => field.filter?.primary) | |||
.map(toFieldFilter(sortedData)); | |||
|
|||
const onSetPage: ( | |||
_evt: React.MouseEvent | React.KeyboardEvent | MouseEvent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_evt: React.MouseEvent | React.KeyboardEvent | MouseEvent, | |
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, |
219d5ff
to
24c1c1f
Compare
@@ -87,7 +87,10 @@ export const GroupedEnumFilter = ({ | |||
</SelectGroup> | |||
)); | |||
|
|||
const onFilter = (_, textInput) => { | |||
const onFilter: ( | |||
e: React.ChangeEvent<HTMLInputElement> | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event
}; | ||
|
||
const onPerPageSelect: ( | ||
_evt: React.MouseEvent | React.KeyboardEvent | MouseEvent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event
24c1c1f
to
c2c5baa
Compare
@@ -350,6 +350,27 @@ export function StandardPage<T>({ | |||
.filter((field) => field.filter?.primary) | |||
.map(toFieldFilter(sortedData)); | |||
|
|||
const onSetPage: ( | |||
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, | |
event: React.MouseEvent | React.KeyboardEvent | MouseEvent, |
no need for _
in the type definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, but this is how it was declared in PF for the function so I wanted to keep the same signature as much as possible.
https://github.com/patternfly/patternfly-react/blob/db0cdde6e3e6ae61348129b73bb43c97a98b4617/packages/react-core/src/components/Pagination/Pagination.tsx#L82
Anyway, I can see now that it was fixed for PF react 5, so will fix it in our code as well.
}; | ||
|
||
const onPerPageSelect: ( | ||
_event: React.MouseEvent | React.KeyboardEvent | MouseEvent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference: kubev2v#1098 For avoiding uncaught PF 4 -> PF 5 migration errors, this PR named and typed (i.e. (add type to function signature) the following callbacks appearances which use parameters: onFilter onTextInput onClear onDrop onInputKeyDown onSetPage onPerPageSelect onUserMinus onUserPlus onDataChange onTextChange Signed-off-by: Sharon Gratch <[email protected]>
c2c5baa
to
60691e8
Compare
Reference: #1098
For avoiding uncaught PF 4 -> PF 5 migration errors, this PR named and typed (i.e, add type to function signature) the following callbacks appearances which use parameters:
onFilter
onTextInput
onClear
onDrop
onInputKeyDown
onSetPage
onPerPageSelect
onUserMinus
onUserPlus
onDataChange
onTextChange