Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Reload app on useRecordActionData hook

Topic Labels: Custom extensions
536 3
cancel
Showing results for 
Search instead for 
Did you mean: 

I’ve built a custom app which has functionality to both use it in the sidebar or have it triggered when you press a button field. I’d like to force the app to reload any time the useRecordActionData hook detects a change. How would I go about pinning that kind of functionality to the hook?

I’m trying to reset all the various React states whenever there’s new info from the hook.

3 Replies 3

regular ol’ useEffect() could do it.

useEffect(() => {
   setState(...)
}, [recordActionData.recordId])

Brilliant. I’m new to React so I love learning some “goole 'ole” tricks. Thank you!

I’m still having some trouble here. useEffect() is great for resetting the states, but it’s not helpful for resetting the UI after a second button click.

This is working:

  • User can fill out form when opening the app from the sidebar
  • User can click a button field to trigger recordActionData to pre-fill some of the fields in the form with the selected record.

What’s not working:

  • If the user has already clicked the button field, clicking the button field on a second record doesn’t pre-fill the fields with the second record’s info. The UI is stuck on the first record’s data.

I realize this is because useEffect() runs its logic after the app renders. It seems like updates to useRecordActionData() don’t force the components to re-render.

How can I get updated data into the UI before a re-render every time the recordActionData is updated?