Refresh after Update record

Is it a bug for the List-detail block (list-with-deletable-elements-vertical-cards)
to not refresh after Update record?

Really would prefer to not use the refresh hacks I see out there.

Also has anyone customised the Update record as it is really basic looking.

It should be a bug let us check it. Any chance @cooper you can share a loom video ?

Hey @cooper,

Just informing that the team is checking, will keep you posted once having an update.

Artur, loom here ➤

Hi Cooper,
You can use this custom code to force the page to reload after you submitted the edit action from the edit modal.
Not the best pattern using this (@dcoletta right?) and waiting @artur for a solution but it should work!

Insert this code in the footer - at page level

<script type="text/javascript">
$( window ).on( "load" , function() {
    setTimeout(function() {
    var buttons = document.getElementsByClassName('modal__btn modal__btn-primary');
    var numButtons = buttons.length;
function refresh() {
    window.location.reload();
}
for (var i = 0; i < numButtons; i++) {
  buttons[i].addEventListener('click', refresh, false);
}
}, 4000);
});
</script>
2 Likes

Perfect, thank you :man_bowing:

PS Had not realised there is a modal for each item! added this to the script to change modal title.

document.getElementsByTagName('h2').forEach(function(e){
 e.innerHTML='Remove from dashboard';
});
1 Like

Thanks! Didn’t see it either!

1 Like

Hello,

We have found the issue.

You have setup “delete record” workaround, and we have not considered this use case in our implementation.

The team will surely fix it, will keep you posted once the update is available.

Sorry for the inconvenience.

1 Like

Hi,

Thanks a lot for this hack, it’s really useful!

Following this, I have a question: Is it possible to modify the script to target a specific block using the block ID, instead of refreshing the whole page?

Maybe it won’t be helpful in the future thanks to Softr Dev Team optimizations but taking any suggestions in the meantime.
Thanks!

1 Like

The only thing I found is:

The only way to refresh at the block level instead of at the page level is if you embed the block in a custom code block.

1 Like

Hi, does this code work even after updating the new action buttons?
I’m looking for a code that will refresh the page after editing. Because I have a filter in the block whose value changes during editing and the page must be refreshed to display the latest data according to the filter.
I tried, and for some reason the script doesn’t work for me

I have the same question as @rrbb

@rrbb @shifthappens

Here is the code to refresh a page after editing (updating).

To be inserted in the custom code footer - page level.

BlockID to be changed, as always.

<script>
  document.addEventListener('DOMContentLoaded', () => {
    window.addEventListener('update-record-success-blockID', () => {
      window.location.reload();
    });
  });
</script>

1 Like

Do you know of a way to modify this to force a page refresh after making an API call with a button on List Details?

@Jakob I guess you are referring to new API Call action right ? Let me check and get back

Correct. It would be nice to have the option for an action to occur after the API has been called, such as refresh parent page, redirect to a different page, etc.

It would be really nice if it was built into the backend Softr process to have blocks watch for updates and just update on demand as needed (I know, easier said than done).

But I notice I spend a ton of time trying to hack together a solution for updating and refreshing individual blocks AFTER an action runs, which results in updated table data. Lots of times we have an action button that triggers a Zapier zap that does some “stuff” and updates various Airtable tables/fields, but there’s no native mechanism today in Softr to refresh individual blocks.

@Jakob Will share the event name tomorrow we have one but we are renaming now :smiley:

@nocodeking we are thinking some sort of workflow builder in the future e.g. do call then wait x seconds then reload and so on

2 Likes