material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Popper][Base] Fix Tooltip Anchor Element Setter

Open sydneyjodon-wk opened this issue 3 years ago • 2 comments

Problem

When props.anchorEl is a function, it sometimes gets called with one argument when it expects no arguments (see codesandbox example).

Cause

This is happening because the state setter setTooltipAnchorEl(anchorEl) (recently added in #34714) calls a function anchorEl as if it were in the form of setTooltipAnchorEl((prev) => next).

Solution

We should call resolveAnchorEl on anchorEl before setting tooltipAnchorEl.

sydneyjodon-wk avatar Dec 13 '22 21:12 sydneyjodon-wk

Messages
:book: Netlify deploy preview: https://deploy-preview-35469--material-ui.netlify.app/

Details of bundle changes

Generated by :no_entry_sign: dangerJS against c7ab9d2acda0996ed4e53478bec6748950291256

mui-bot avatar Dec 13 '22 21:12 mui-bot

@mnajdova @michaldudak this is ready for review when you get a chance! Thanks!

sydneyjodon-wk avatar Dec 13 '22 22:12 sydneyjodon-wk

LGTM @michaldudak Can you take a final look?

siriwatknp avatar Dec 19 '22 04:12 siriwatknp

Looks good! I do have one remark about naming, but apart from that it's good to go.

michaldudak avatar Dec 20 '22 07:12 michaldudak