Auto refresh displayed block data

Hi Nick! We should be able to do this via custom code snippets. I have your use case in my todos

1 Like

Hi @artur, Do you have a custom code for this case ? Thank you.

Hi Virginie

This is the code we use
Hope this helps

Dan

image

This may work for this use case:
I create a page called ‘refresh’
Added a code block and added the following code to it:

<script>
window.history.back();
</script>

For any form submission or CTA button, that i wish to trigger a page refresh, I set it to open new page ‘refresh’. The new page opens, script runs and takes user back to the page where the button was pressed, all in under a second. Works with list-details pages too.

I created a comments section with an ability to refresh page when new comment was added. The ‘submit comment’ button opened the page ‘refresh’ and that brought the user back to the page where the comment was posted, with updated records. Works like a charm.

6 Likes

You absolute legend!

Hey @vikasvimal,

Thanks for sharing this workaround.

it works! thanks @vikasvimal

3 Likes

hello what about you don’t want to go back to the previous page but reload the current page which you weren’t there before

1 Like

I don’t know if it’s related to your other post concerning Stripe but it would be this

<script>
window.location.reload();
</script>

okay so will this be on the home page?

If it’s related to your use case from the other post, nope, was just a basic answer to your question.

Maybe you can try this one, on homepage header

<script>
setTimeout("location.reload(true);", 5000);
</script>

This should reload the page after 5 seconds (set it to 2000 or 3000 for 2 or 3 seconds)

PS: not 100% sure of my coding skills, This is a basic code, that doesn’t take in consideration the context of your issue. But you can try it, it won’t destroy anything :sweat_smile:

this work, but the reload is still on like, it’s continuously,

On it

Here’s an alternative script to try. Put this script in the Code inside header of the page that you need to be reloaded.

<script>
    const urlParams = new URLSearchParams(location.search);
    const reload = urlParams.get('reload');
    if (reload ==='true') {
        var newLocation = location.href;
        newLocation = newLocation.replace('reload=true', 'reload=false');
        location.replace(newLocation);
    }
</script>

Then, when you need the page to reload, navigate to it with the querystring ?reload=true. So for example if you are sending the user to /, instead send them to /?reload=true.

What will happen is the page will begin to load, it will detect the reload=true, it will change that value to reload=false, and then it will reload the page one time.

Now that David solved this, I would need a small help from you, if possible.

Could you just tell me, by replying here, if the whole process makes everything work? Stripe subscription then redirect to page then reload the page then the user is set as “paid user” for good and everything displays correctly according to his/her new status of paid customer.

It would be of a great help if I could suggest a solution to my client too. And for everyone here.

Thanks in advance !!

the process of detecting the reload=true , and changing that value to reload=false, can timer be set in that midst?

Hey @dcoletta / @matthieu_chateau where are you actually inputting the

/?reload=true

Because on the page URL (in the general settings) I can not input a ? or = symbols. It just makes it a -

Hope you can help!

Hi everyone.

I have a slightly different use case.

I am using the Account Profile block. Above it, I have a CTA block used for a message that says “hey, you are missing some account profile data”. The visibility of the CTA “warning” block is mapped to a a user group that checks for the Account Profile’s corresponding Airtable fields not to be empty. The idea is that the CTA “warning” block only shows up if some fields are missing data.

When I fill out the Account Profile block’s form, it updates the Airtable, but the CTA “warning” block does not disappear. Unless I reload the page - not a good user experience.

Any thoughts on how to handle this, such that the warning would disappear automatically, right after all the fields in the Account Profile have been populated and the Update button has been clicked?

Thanks
Boris

This would be possible if we add callback options for user account block form submission. After the form submission then it would be possible to reload the page. Can you DM some details so I can become a test user and try in your app ?

Hi everyone

I have a variation on this issue that I’m hoping someone can help me with please.

I have a form on a page that triggers an API through Make and the results of the API are returned in a list below the form. I’m using the following custom code inside the footer that refreshes the page after 9 seconds so that the results appear in the list.

<script>
var form1 = document.getElementById('form1');
form1.addEventListener('submit', function() {
  setTimeout(function() {
    window.location.reload();
  }, 9000);
});
</script>

It works 9 times out of 10 (I think the API sometimes takes longer). However, I’d like to give the user a visual indicator (such as a loader) under the form that we’re waiting for the page to refresh and the results to appear. I’ve experimented with various iterations, but don’t seem to be getting anywhere. Any advice would be much appreciated!

Thank you.