Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
fix(Tooltip): Fix page crash when content is null (#2332)
Browse files Browse the repository at this point in the history
* screener test for remote repo

* changelog
  • Loading branch information
jurokapsiar authored Feb 11, 2020
1 parent 859b8aa commit d7896d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Fixes
- Remove dependency on Lodash in TypeScript typings @layershifter ([#2323](https://github.com/microsoft/fluent-ui-react/pull/2323))
- Fix missing aria-describedby in AlertBehavior @delprzemo ([#2208](https://github.com/microsoft/fluent-ui-react/pull/2208))
- Fix page crash when `Tooltip` content is null @delprzemo ([#2332](https://github.com/microsoft/fluent-ui-react/pull/2332))
- Fix `document` usage in `mergeProviderContexts` to get SSR working @layershifter ([#2330](https://github.com/microsoft/fluent-ui-react/pull/2330))

### Features
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ export default class Tooltip extends AutoControlledComponent<TooltipProps, Toolt
overrideProps: this.getContentProps,
})

if (!tooltipContent) return null

return <Ref innerRef={this.contentRef}>{tooltipContent}</Ref>
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/utils/positioner/Popper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const Popper: React.FunctionComponent<PopperProps> = props => {
? children({ placement: computedPlacement, scheduleUpdate })
: (children as React.ReactElement)

return <Ref innerRef={contentRef}>{React.Children.only(child)}</Ref>
return child ? <Ref innerRef={contentRef}>{React.Children.only(child)}</Ref> : null
}

Popper.defaultProps = {
Expand Down

0 comments on commit d7896d0

Please sign in to comment.