Bug: Safari + UITable

I’m trying to build a script that generates a UITable with rows that open a URL via Safari.openInApp(). This works but only once. I want the table to present itself again after Safari.openInApp() finishes.

Let me know if I’m missing something. Thanks!

Sample code:

var table = new UITable()
var rows = [
	{ url: "http://www.google.com" },
	{ url: "http://www.google.com" },
	{ url: "http://www.google.com" }
]
for (i in rows) {
	var row = rows[i];
	
	var row = new UITableRow()
	row.addText( i );
	row.onSelect = function(i) {
		var url = rows[i].url;
		
		Safari.openInApp( url ).then(function() {
			table.present()
		})
	}
	table.addRow( row )
}

table.present()

Many of your function calls like openInApp() and present() return promises, but you aren’t using any awaits, so my guess is the code is probably running away.

There is a property on the UITableRow, to not dismiss the UITable: https://docs.scriptable.app/uitablerow/#dismissonselect

Try setting it to false on every row and the UITable should stay open beneath the in-app browser.

1 Like

That did it! Thanks!

I’ve now tried your code, also with awaits instead of .then(), but to no avail. It worked with a WebView instead of Safari in-app browser. Looks like this is really a bug… @simonbs can you please have a look?

Thanks for tour feedback. I have it on my todo to look into this issue for the next release.

1 Like

I’ve just implemented a fix for this which will be included in Scriptable 1.4.10 which should be on the App Store soon.

3 Likes

Its giving me the same error