workaround for reloading events too early

This commit is contained in:
Daniel Waxweiler 2022-06-09 19:09:27 +02:00
parent 4372ffc66c
commit 5a0757092b
1 changed files with 8 additions and 6 deletions

View File

@ -14,15 +14,17 @@ export default ({ attributes, setAttributes }) => {
'data-maximum': attributes.eventsCount,
'data-group-name': attributes.groupName,
})
function reloadEventList() {
setTimeout(() => {
const container = document.getElementById(blockProps.id)
if (container) {
loadEventList(container)
}
}, 0)
}
useEffect(() => {
reloadEventList()
}, [])
function reloadEventList() {
const container = document.getElementById(blockProps.id)
if (container) {
loadEventList(container)
}
}
function updateEventsCount(event) {
let newValue = Number(event.target.value)
if (newValue < 1) newValue = 1