Automatically refresh a “list” block

Hello, :wink:
I would need custom code to only refresh a “list” block on a page.

More precisely :

When I add a document via Softr, the document lands in the Airtable field and an automation is triggered. But it takes time for automation to do its job.

The problem is that Softr displays the document and the information, long before the automation has finished filling in the other information fields.

So Softr displays both the document and the empty fields.

Instead of refreshing the entire page, I would like to refresh the block only when the automation has finished its process.


So :

1. Either I need a custom code that allows the block to be updated every 10 seconds.

2. Or a custom code that detects when the Airtable fields are ready to be displayed to update the block.

Thank you in advance for your help. :pray:t3:

1 Like

Hey @Vincent !
This code lets you refresh the block every 10 seconds, enjoy!
Just put it inside the page’s custom code header section and replace blockid with the actual block name.

<script>
window.addEventListener('block-loaded-blockid', () => {
setInterval(() => {
window.dispatchEvent(new CustomEvent('reload-block-blockid'));
}, 10000);
});
</script>```
2 Likes

Merci Andranik. :+1:t3:

2 Likes

Always a pleasure @Vincent !

1 Like