Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/components/variant-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
box-shadow: var(--shadow-resting-medium, 0 3px 6px rgba(140, 149, 159, 0.15));
`

const VariantItem = ({title, shortName, url, active}) => (
<ActionList.Item as={LinkNoUnderline} to={url} state={{scrollUpdate: false}} id={shortName} active={active}>
{title}
</ActionList.Item>
)
const VariantItem = ({title, shortName, url, active}) => {
return (
<ActionList.Item state={{scrollUpdate: false}} id={shortName} active={active}>
<LinkNoUnderline to={url}>{title}</LinkNoUnderline>
</ActionList.Item>
)
}

const useVariantFocus = () => {
const locationChange = useLocationChange()
Expand All @@ -37,6 +39,13 @@
const [open, setOpen] = React.useState(false)
const anchorRef = useVariantFocus()
const labelId = 'label-versions-list-item'
const locationChange = useLocationChange()

React.useEffect(() => {
if (locationChange.change && getNav.didVariantChange(locationChange.previous, locationChange.current)) {
setOpen(false)
}
}, [locationChange.change, locationChange.current, locationChange.previous])

Check warning on line 48 in src/components/variant-select.js

View workflow job for this annotation

GitHub Actions / Lint

React Hook React.useEffect has a missing dependency: 'locationChange'. Either include it or remove the dependency array. Mutable values like 'locationChange.current' aren't valid dependencies because mutating them doesn't re-render the component

return (
<>
Expand Down
Loading