Immediate update on click

Hey all,

I did search for this before posting!

I’m building a to-do list inside a client portal (linked to airtable).

At the moment I am using a one-click update button, which updates a field to filter it from the Airtable view. It takes a page refresh to remove it from view.

CleanShot 2023-07-31 at 14.06.53

Essentially all I am trying to do, is when they click that they’ve completed the task, it is removed from the list. Any better work arounds?

1 Like

Hi,
This is possible with a small code snippet, but do you use a table block or a list block?

1 Like

Thanks Matthieu,

I’m using a list, but have no issues using a table if needed?

So right now the code snippet will work with a list block. Not yet with a table block.

I need an update from @artur about it.

Here is the code to insert in the page settings, in the footer part of “Custom code”

Just change list2 (second line and fourth line) by the current Name/ID of your block

The block will reload itself when a successful update occurs, after 2 seconds.

<script>
  window.addEventListener('update-record-success-list2', () => {
    setTimeout(() => {
      window.dispatchEvent(new CustomEvent('reload-block-list2'));
    }, 2000);
  });
</script>
1 Like

reload for table block will come approximately end of this week

2 Likes

Thanks so much Matthieu! Such a help!