Refresh specific block after one-click update

Ok
(No need to show me the details of the automation, it’s not strictly related)

Can you try

<script>
window.addEventListener('call-api-success-list1', () => {
  setTimeout(() => {
    window.dispatchEvent(new CustomEvent('reload-list3'));
  }, 2000); //adjust here for more delay
});
</script>

Or

<script>
window.addEventListener('block-loaded-list1', () => {
  window.addEventListener('call-api-success-list1', () => {
    setTimeout(() => {
      window.dispatchEvent(new CustomEvent('reload-list3'));
    }, 2000); // adjust here for more delay
  });
});
</script>

Or

<script>
window.addEventListener('call-api-success-list1', (e) => {
    console.log('call-api-success', e.detail);
    
    setTimeout(() => {
        window.dispatchEvent(new CustomEvent('reload-list3'));
    }, 2000); // adjust here for more delay
});
</script>

It’s a 2 seconds delay… You might need more according to the automation (Script in Automation being slow in Airtable)

Docs for event listenners related to call api => Call API – Softr Help Docs at the bottom of the page

Complete thread about your need => Reload after api call succeed (for further help if needed)

If you prefer reloading the page

<script>
    window.addEventListener('call-api-success-list1', () => {
        setTimeout(() => {
               window.location.reload()
        }, 2000); // adjust here for more delay
	});
</script>
1 Like