Skip to content
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

After bump to 5.0.0 bindTrigger stop working #114

Closed
darkkatarsis opened this issue Dec 12, 2022 · 4 comments
Closed

After bump to 5.0.0 bindTrigger stop working #114

darkkatarsis opened this issue Dec 12, 2022 · 4 comments
Labels

Comments

@darkkatarsis
Copy link

As I mentioned in the title, after bumping up to the latest version, I noticed that the trigger does not change state.

React version: 18.2.0

Example code that stopped working

import * as React from 'react'
import Button from '@mui/material/Button'
import Menu from '@mui/material/Menu'
import MenuItem from '@mui/material/MenuItem'
import {
  usePopupState,
  bindTrigger,
  bindMenu,
} from 'material-ui-popup-state/hooks'

const MenuPopupState = () => {
  const popupState = usePopupState({ variant: 'popover', popupId: 'demoMenu' })
  return (
    <div>
      <Button variant="contained" {...bindTrigger(popupState)}>
        Open Menu
      </Button>
      <Menu {...bindMenu(popupState)}>
        <MenuItem onClick={popupState.close}>Cake</MenuItem>
        <MenuItem onClick={popupState.close}>Death</MenuItem>
      </Menu>
    </div>
  )
}

export default MenuPopupState
@jedwards1211
Copy link
Member

jedwards1211 commented Dec 12, 2022

I wasn't able to reproduce this myself, but I did catch some other issues like with the ESM exports and just released v5.0.1. Can you see if that version fixes the problem? If not can you make a repo or CodeSandbox that reproduces the issue?

@jedwards1211
Copy link
Member

Okay I believe I found the cause of the issue, once 5.0.3 gets released (there will be a comment on this issue), try that

@jedwards1211
Copy link
Member

🎉 This issue has been resolved in version 5.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@darkkatarsis
Copy link
Author

@jedwards1211 I confirm, everything works. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants