Skip to content

Conversation

@thatblindgeye
Copy link
Contributor

@thatblindgeye thatblindgeye commented Aug 26, 2022

What: Closes #7553

  • Made updates based on original issue
  • Resolved errors of Cannot invoke an object which is possibly 'undefined' for optional function props that get called within components by adding optional chaining
  • Few other fixes for possibly undefined errors by adding optional chaining or if blocks

Additional issues:

Created #7889 for potential follow-up

@patternfly-build
Copy link
Collaborator

patternfly-build commented Aug 26, 2022

@thatblindgeye thatblindgeye marked this pull request as ready for review September 2, 2022 13:08
Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

LGTM

additionalChild?: React.ReactNode;
/** Custom item rendering that receives the DropdownContext */
customChild?: React.ReactNode;
/** tabIndex to use, null to unset it */
Copy link
Member

Choose a reason for hiding this comment

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

Should this description be updated now that null is no longer an acceptable value?

Copy link
Contributor

Choose a reason for hiding this comment

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

@thatblindgeye the functionality is still the same correct? The prop will still take a null value, so a null value can still be set to unset it.
Maybe we can add unit for a sanity check.

Copy link
Contributor Author

@thatblindgeye thatblindgeye Sep 9, 2022

Choose a reason for hiding this comment

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

I don't get any errors when trying to pass tabIndex={null} in an example file. For a unit test, would we just want to check that passing in null results in no tabindex attribute being applied?

EDIT: Disregard the above, I am getting a TS error when passing in null to tabIndex now

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good - sorry for the misunderstanding!

Copy link
Contributor

Choose a reason for hiding this comment

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

If it used to accept null, and now it's going to throw an error, is that a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Titani did mention it would be. My recent commit just now adds back null types to the TreeviewListItem and DropdownItem components, and adds in an Omit... to both to resolve the TS error being flagged in strict mode

@kmcfaul
Copy link
Contributor

kmcfaul commented Sep 9, 2022

Reran the failing integration job and looks like its all good. I ran into that on one of my PRs too, it looks like something in the tabsHorizontalOverflow tests is a bit inconsistent.

Copy link
Member

@evwilkin evwilkin left a comment

Choose a reason for hiding this comment

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

LGTM

@evwilkin evwilkin merged commit 011215b into patternfly:main Sep 9, 2022
@patternfly-build
Copy link
Collaborator

Your changes have been released in:

  • eslint-plugin-patternfly-react@4.76.4
  • @patternfly/react-catalog-view-extension@4.88.4
  • @patternfly/react-charts@6.90.4
  • @patternfly/react-code-editor@4.78.4
  • @patternfly/react-console@4.88.4
  • @patternfly/react-core@4.237.4
  • @patternfly/react-docs@5.98.4
  • @patternfly/react-icons@4.88.4
  • @patternfly/react-inline-edit-extension@4.82.4
  • demo-app-ts@4.197.4
  • @patternfly/react-integration@4.199.4
  • @patternfly/react-log-viewer@4.82.4
  • @patternfly/react-styles@4.87.4
  • @patternfly/react-table@4.106.4
  • @patternfly/react-tokens@4.89.4
  • @patternfly/react-topology@4.84.4
  • @patternfly/react-virtualized-extension@4.84.4
  • transformer-cjs-imports@4.75.4

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - Modal, DropDownItem, TreeView - strict TypeScript type checking fails

7 participants