mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
🐛 Fix sidebar closing regardless if dropdown is open
This commit is contained in:
parent
9a2e239ef0
commit
0a7da60e4f
@ -315,7 +315,7 @@ export default class Sidebar extends React.Component {
|
|||||||
return window.app.setLocation(`/${e.key}`, 150)
|
return window.app.setLocation(`/${e.key}`, 150)
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleExpanded = (to) => {
|
toggleExpanded = (to, force) => {
|
||||||
to = to ?? !this.state.expanded
|
to = to ?? !this.state.expanded
|
||||||
|
|
||||||
if (this.collapseDebounce) {
|
if (this.collapseDebounce) {
|
||||||
@ -323,12 +323,11 @@ export default class Sidebar extends React.Component {
|
|||||||
this.collapseDebounce = null
|
this.collapseDebounce = null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!to & this.state.dropdownOpen && !this.state._shouldCollapse) {
|
if (!to & this.state.dropdownOpen && !force) {
|
||||||
// FIXME: This is a walkaround for a bug in antd, causing when dropdown set to close, item click event is not fired
|
// FIXME: This is a walkaround for a bug in antd, causing when dropdown set to close, item click event is not fired
|
||||||
// The desing defines when sidebar should be collapsed, dropdown should be closed, but in this case, gonna to keep it open untils dropdown is closed
|
// The desing defines when sidebar should be collapsed, dropdown should be closed, but in this case, gonna to keep it open untils dropdown is closed
|
||||||
//this.setState({ dropdownOpen: false })
|
//this.setState({ dropdownOpen: false })
|
||||||
|
|
||||||
this.setState({ _shouldCollapse: true })
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,9 +368,8 @@ export default class Sidebar extends React.Component {
|
|||||||
|
|
||||||
onDropdownOpenChange = (to) => {
|
onDropdownOpenChange = (to) => {
|
||||||
// this is another walkaround for a bug in antd, causing when dropdown set to close, item click event is not fired
|
// this is another walkaround for a bug in antd, causing when dropdown set to close, item click event is not fired
|
||||||
if (this.state._shouldCollapse) {
|
if (!to && this.state.expanded) {
|
||||||
this.setState({ _shouldCollapse: false })
|
this.toggleExpanded(false, true)
|
||||||
this.toggleExpanded(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ dropdownOpen: to })
|
this.setState({ dropdownOpen: to })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user