Debounce hiding side panel to avoid toggling visibility when cycling through records
This commit is contained in:
parent
e56b5cde90
commit
bcc0fe71da
|
@ -11,18 +11,25 @@ export const createSidePanelStore = () => {
|
|||
open: $store.contentId != null,
|
||||
}
|
||||
})
|
||||
let timeout
|
||||
|
||||
const open = id => {
|
||||
clearTimeout(timeout)
|
||||
store.update(state => {
|
||||
state.contentId = id
|
||||
return state
|
||||
})
|
||||
}
|
||||
|
||||
// Delay closing by 50ms to avoid toggling visibility when cycling though
|
||||
// records
|
||||
const close = () => {
|
||||
timeout = setTimeout(() => {
|
||||
store.update(state => {
|
||||
state.contentId = null
|
||||
return state
|
||||
})
|
||||
}, 50)
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue