Reload the page with delay when adding record to a list block

Hello,
use this code in your page settings → Custom code ->. Footer section to reload the page when a record is added to a list block. Just replace the BLOCKID with your block name. Save and publish.

<script>
	window.addEventListener('submit-form-success-BLOCKID', () => {
	  setTimeout(() => {
                 //RELOAD BLOCK
                 window.dispatchEvent(new CustomEvent('reload-block-list1'));
		
               //RELOAD PAGE
               window.location.reload()
        }, 3000);
	});
</script>