mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
fix loading multiple blocks
This commit is contained in:
@ -6,6 +6,7 @@
|
|||||||
#### Deprecated
|
#### Deprecated
|
||||||
#### Removed
|
#### Removed
|
||||||
#### Fixed
|
#### Fixed
|
||||||
|
- Not loading more than one block in Gutenberg editor
|
||||||
#### Security
|
#### Security
|
||||||
|
|
||||||
### [0.11.5]
|
### [0.11.5]
|
||||||
|
@ -14,9 +14,8 @@ const { __ } = wp.i18n
|
|||||||
|
|
||||||
const NAME = '<wordpress-name>'
|
const NAME = '<wordpress-name>'
|
||||||
|
|
||||||
let timer
|
|
||||||
|
|
||||||
export default ({ attributes, setAttributes }) => {
|
export default ({ attributes, setAttributes }) => {
|
||||||
|
let timer
|
||||||
const { eventsCount, groupName } = attributes
|
const { eventsCount, groupName } = attributes
|
||||||
const blockProps = useBlockProps({
|
const blockProps = useBlockProps({
|
||||||
className: NAME + '_events-list',
|
className: NAME + '_events-list',
|
||||||
@ -25,7 +24,7 @@ export default ({ attributes, setAttributes }) => {
|
|||||||
if (timer) {
|
if (timer) {
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
}
|
}
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(async () => {
|
||||||
const container = document.getElementById(blockProps.id)
|
const container = document.getElementById(blockProps.id)
|
||||||
if (container) {
|
if (container) {
|
||||||
hideErrorMessages(container)
|
hideErrorMessages(container)
|
||||||
@ -35,7 +34,7 @@ export default ({ attributes, setAttributes }) => {
|
|||||||
if (groupName) {
|
if (groupName) {
|
||||||
url += `&groupName=${groupName}`
|
url += `&groupName=${groupName}`
|
||||||
}
|
}
|
||||||
fetch(url)
|
await fetch(url)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return Promise.reject('Network response was not OK.')
|
return Promise.reject('Network response was not OK.')
|
||||||
|
Reference in New Issue
Block a user