Love this!
Please yes, I have now multiple clients who have to reload manually after an api call is made! Was there any solution presented for @Jakob ?
Hi there, I have tried using many versions of the example scripts in this thread but canât get the desired outcome.
I have a list block called projects and then another list called order where the visibility is configured so the order block only shows when the record in the project has a certain status.
I have a one click event to update the status of the project record. So ideally when this happens, the orders block should then show. I can only get this to happen with a manual refresh of the page.
Can you advise please?
Thanks
Hi Jen,
If the block is hidden at first, unfortunately you canât play with javascript to display it => Itâs impossible to play with an element that is not already loaded in the page. Said differently you canât use a frontend code for something that doesnât exist (which is normal).
Terminology used in the Softr studio can be misleading. In Softr it says âshowâ or âhideâ something. Itâs not exactly true => it loads or it doesnât load something, which is different.
And only a page refresh (using Javascript) would solve the problem.
This would be the script to use, to be inserted in the page settings => custom code header
<script>
window.addEventListener('block-loaded-projects', () => {
window.addEventListener('update-record-success-projects', () => {
setTimeout(() => {
location.reload();
}, 500);
});
});
</script>
Thank you so much for the explanation, I assumed hidden meant it was still on the page so it is great to understand how itâs working.
Iâve tried the code and it works perfectly, thanks again!
Sorry to come back on this, I am trying to perform a similar action but I am struggling.
On the same page as before, I have a list block (ordersubmit) which has a one click action, which updates an order status (an order is link to a project in the base), then in Airtable I have an automation that when the order status updates this updates the project status.
I then have other blocks on this page which show/hide based on the project status. Therefore I thought if I reload the page when that block is updated this would work.
I have noticed that it does refresh the page but the blocks arenât showing correctly. Even when I manually refresh the page it doesnât show, but if I leave it for a minute or so and manually refresh it eventually works.
I assumed this may be due to a delay in the Airtable automation, but this all gets updated straight away and even the project status that shows on the page is correct so I donât know what is going on.
Any help would be greatly appreciated
Can you try to disable the user caching in the app settings => advanced settings.
Also I strongly advise you to go from Airtable Oauth to personal access token. In order to check if Softr is linked to Airtable through OAuth or through personal access token, go to your workspace => datasource. If there is a message behind your Airtable datasource (something like âswitch to personal access tokenâ) = click on it and follow the process (you wonât have to link again your blocks, donât worry).
After doing all of this, there might be some improvements.
If this is not enough a delay of 2 seconds would need to be added in the script.
Thank you, I have just tried this and unfortunately hasnât changed anything. Even a manual refresh after approx 1 minute shows the page as it should be, not sure why it is taking so long.
Anything else I can try? Sorry I am a bit lost with this.
You are currently without user caching and using personal access token?
App re-published?
Test must be done after clearing your browser caching + quit and re-enter your browser.
Also please try with the live app.
Having this issue is not normal (updates after 1 minute) so if no change => Softr customer service.
Yes, removed user caching and changed to using the personal access token.
Republished. I always test using the live app as I find the preview a little temperamental.
Thanks for all your help
Hey @artur @Jakob was there ever a solve for reloading page after API call? Iâm using the new Call API button and a way to refresh the page after would be very helpful.
@acjnas do you know if there is a way? I donât believe we have a native option still.
Here is what has worked so far:
Thanks @matthieu_chateau