I tried adding a counter:
#let m-cell(table-id) = table.cell(
inset: 0pt,
stroke: none,
layout(s => [#metadata(s)#label(table-id)]),
)
#let m-cells(table-id, n) = (m-cell(table-id),) * n
#let min-height-table(columns: 1, ..args) = {
let table-id = counter("table-id")
table-id.step()
context {
let table-id = "table" + str(table-id.get().first())
let columns-sizes = columns
let sizes = query(label(table-id))
if sizes.len() != 0 {
columns-sizes = sizes.map(md => md.value.width.pt() * 1fr)
}
table(
columns: columns-sizes,
..args,
..m-cells(table-id, columns),
)
}
}
// #min-height-table(columns: 1, lorem(10))
//
// #min-height-table(columns: 1, lorem(20))
// #min-height-table(columns: 2, lorem(5), lorem(10))
// #min-height-table(columns: 2, lorem(10), lorem(5))
#min-height-table(columns: 2, lorem(10), lorem(10))
// #min-height-table(columns: 2, lorem(50), lorem(10))
#min-height-table(columns: 2, lorem(10), lorem(70))
#min-height-table(columns: 3, lorem(10), lorem(50), lorem(10))
#min-height-table(columns: 4, lorem(10), lorem(50), lorem(10), lorem(50))
But not only does it not look correct for my tests, it also throws the warning on 5 tables, hence only 4 are shown.
I then checked your example, and as long as all tables have unique labels, no warning is shown.
#for i in range(100) {
let (a, b, c, d) = range(4).map(j => "table" + str(j) + str(i))
wide-table(a, 3)[#lorem(2)][#lorem(5)][#lorem(2)]
wide-table(b, 3)[#lorem(80)][#lorem(60)][#lorem(2)]
wide-table(c, 3)[#lorem(2)][#lorem(3)][#lorem(4)]
wide-table(d, 3, block(width: 12cm), [], [whoop whoop])
}
I don’t yet fully understand what this does, but it clearly takes at least 2 explicit cycles to get the required table. Typst itself can have several implicit cycles to lay out everything, IIUC. So total it can hit 5 attempts very quickly, at least if you throw in table id counter.
Additionally, it takes a different number of tables to trigger the warning.
It looks like this specific test(s) causes the warning:
#min-height-table(columns: 2, lorem(5), lorem(10))
#min-height-table(columns: 2, lorem(10), lorem(5))
While this does not:
#min-height-table(columns: 1, lorem(10))
#min-height-table(columns: 1, lorem(20))
// #min-height-table(columns: 2, lorem(5), lorem(10))
// #min-height-table(columns: 2, lorem(10), lorem(5))
#min-height-table(columns: 2, lorem(10), lorem(10))
#min-height-table(columns: 2, lorem(10), lorem(10))
#min-height-table(columns: 2, lorem(50), lorem(10))
#min-height-table(columns: 2, lorem(50), lorem(10))
#min-height-table(columns: 2, lorem(10), lorem(70))
#min-height-table(columns: 2, lorem(10), lorem(70))
#min-height-table(columns: 3, lorem(10), lorem(50), lorem(10))
#min-height-table(columns: 4, lorem(10), lorem(50), lorem(10), lorem(50))
#min-height-table(columns: 4, lorem(10), lorem(50), lorem(10), lorem(50))
#min-height-table(columns: 4, lorem(10), lorem(50), lorem(10), lorem(50))