-
Notifications
You must be signed in to change notification settings - Fork 661
update eslint-plugin-react-hooks to latest
#7771
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr | |
| }) => { | ||
| const cssAnchorPositioningFlag = useFeatureFlag('primer_react_css_anchor_positioning') | ||
| const supportsNativeCSSAnchorPositioning = useRef(false) | ||
| // eslint-disable-next-line react-hooks/refs | ||
| const cssAnchorPositioning = cssAnchorPositioningFlag && supportsNativeCSSAnchorPositioning.current | ||
| const anchorRef = useProvidedRefOrCreate(externalAnchorRef) | ||
|
Comment on lines
166
to
170
|
||
| const [overlayRef, updateOverlayRef] = useRenderForcingRef<HTMLDivElement>() | ||
|
|
@@ -221,6 +222,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr | |
| displayInViewport, | ||
| onPositionChange: positionChange, | ||
| }, | ||
| // eslint-disable-next-line react-hooks/refs | ||
| [overlayRef.current], | ||
| ) | ||
|
|
||
|
|
@@ -256,11 +258,13 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr | |
| overlay.style.removeProperty('position-anchor') | ||
| } | ||
| } | ||
| // eslint-disable-next-line react-hooks/refs | ||
| }, [cssAnchorPositioning, anchorRef, overlayRef, id, open]) | ||
|
|
||
| // Track the overlay element so we can re-run the effect when it changes. | ||
| // The overlay unmounts when closed, so each open creates a new DOM node - | ||
| // that needs showPopover() called. | ||
| // eslint-disable-next-line react-hooks/refs | ||
| const overlayElement = overlayRef.current | ||
|
|
||
| useLayoutEffect(() => { | ||
|
|
@@ -289,6 +293,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr | |
| } catch { | ||
| // Ignore if popover is already showing or not supported | ||
| } | ||
| // eslint-disable-next-line react-hooks/refs | ||
| }, [cssAnchorPositioning, open, overlayElement, id, overlayRef, anchorRef, width]) | ||
|
|
||
| const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton | ||
|
|
@@ -300,6 +305,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr | |
| return ( | ||
| <> | ||
| {renderAnchor && | ||
| // eslint-disable-next-line react-hooks/refs | ||
| renderAnchor({ | ||
| ref: anchorRef, | ||
| id: anchorId, | ||
|
|
||
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.
the eslint plugin will complain about a function component created inside a component - we can extract to module scope to fix