-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Removing findDOMNode usage from Pivot #15558
Removing findDOMNode usage from Pivot #15558
Conversation
Thanks for submitting this change, but due to work currently in progress to prepare |
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.
You'll probably need to update a bunch of snapshots (probably in all the packages) due to the button change.
Hmm actually never mind, the build seems to have passed with no snapshot changes?? |
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Perf comparison
Perf tests with no regressions
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d63fd49:
|
Asset size changes
Over Tolerance (1024 B) Over Baseline Below Baseline New Removed 1 kB = 1000 B Baseline commit: d2fedc85c81bb0e2d86495ec1e928604bf2260f4 (build) |
const { componentRef, theme, linkSize, linkFormat, overflowBehavior } = props; | ||
const pivotId: string = useId('Pivot'); | ||
let linkCollection = getLinkItems(props, pivotId); | ||
const focusZoneRef = React.useRef<IFocusZone>(null); | ||
const divProps = getNativeProps<React.HTMLAttributes<HTMLDivElement>>(props, divProperties); | ||
const overflowMenuButtonComponentRef = React.useRef<IButton>(null); | ||
const pivotId: string = useId('Pivot'); | ||
|
||
const [selectedKey, setSelectedKey] = useControllableValue(props.selectedKey, props.defaultSelectedKey); | ||
|
||
const { componentRef, theme, linkSize, linkFormat, overflowBehavior } = props; | ||
// The overflow menu starts empty and items[] is updated as the overflow items change | ||
const overflowMenuProps: IContextualMenuProps = { | ||
items: [], | ||
doNotLayer: true, | ||
alignTargetEdge: true, | ||
directionalHint: DirectionalHint.bottomRightEdge, | ||
}; | ||
|
||
let classNames: { [key in keyof IPivotStyles]: string }; | ||
const divProps = getNativeProps<React.HTMLAttributes<HTMLDivElement>>(props, divProperties); | ||
|
||
let linkCollection = getLinkItems(props, pivotId); |
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.
(nit) out of curiosity, why are you moving around so many lines of code in this function? It's fine to clean things up if the code is messy, but this doesn't necessarily seem better than it was before. (E.g. previously, overflowMenuProps was declared closer to where it's used, which makes more sense to me). It's not necessarily a problem, but it seems unnecessary and makes the diff harder to read.
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.
I reverted the overflowMenuProps move and the diffing should be improved. The intention is to help keep consistency in Pivot’s useRef and useState/useControllableValue placement to follow patterns in other functional components.
…eat/react-internal-pivot-findDOMNode
🎉 Handy links: |
Pull request checklist
$ yarn change
Description of changes
Removing findDOMNode usage from the react-tabs
Pivot
component.Changing BaseButton's wrapper span to a fragment in react-internal
(This change was made to allow elementRef to recieve the root element.)
Adding an elementRef to Pivot's CommandButton
Updating Pivot's CommandButton className
Other Minor Changes
setOverflowMenuButtonRef
and replacing it withoverflowMenuButtonRef
Focus areas to test
Pivot
,BaseButton