Help

useRecords no longer triggering app UI refresh after starting an external handler (mailto)

Topic Labels: Custom Extensions
1650 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Schmidt
4 - Data Explorer
4 - Data Explorer

My app uses data from several tables via useRecords, so normally any table data changes (from other Airtable instances/users or via the in-app “expandRecord” buttons are triggering a UI refresh, reflecting those changes within a few seconds.

However, reproducibly, whenever I start an external “mailto:” handler, either by using a Material UI Link component or directly via a component’s onClick, the app stops updating it’s UI when data is changed outside of it. Any record changes sent from within the app still propagate as intended, but useRecords is no longer triggered when records are changed from outside the app (in another Airtable window or via “expandRecord”).

Only a manual “Reload app” seems to get things working again.

<Link
  href="mailto:name@example.com?subject=Mail"
  className={classes.email}
>
  <MailOutlineIcon size="small" className={classes.taskicon} />
</Link>

... onClick={() => {window.location.href = "mailto:name@example.com?subject=Mail"; }}

As a result of the click action, the console shows this (and opens my mail application as intended):
Launched external handler for 'mailto: ...

Is this a bug or expected behaviour? If the latter, how can I make the app respond to data changes again, or is there a better, recommended way to open “mailto:” links that doesn’t break the app’s read data connection? Thanks!

1 Reply 1
Michael_Schmidt
4 - Data Explorer
4 - Data Explorer

(Partly) answering my own question: a workaround seems to be to add
... target="_blank"
to the link. It’s not ideal, as the new window briefly flashes, but better than the loss of functionality. :slightly_smiling_face:

<Link
  href="mailto:name@example.com?subject=Mail"
  target="_blank"
  className={classes.email}
>

onClick={() => {window.open('mailto:name@example.com?subject=Mail', '_blank'); }}