The table uses the row when predicate to determine which row template to use for a piece of data, but only once when inserting a new row.
This should be evaluated on each emit to confirm that data objects match to the right row template.
https://stackblitz.com/edit/angular-bgzmrf-tbx3dm?file=app%2Ftable-basic-example.ts
OH MY GOD!!!! I cannot believe I wasted 2 hours debugging this case which turns out to be a bug. Are there any plans to fix this or maybe there's a workaround to the issue which I haven't thought of?
In our case, we have an edit button inside the table row. When clicked, the button calls a function which sets the index of the row being edited and that should in theory open the details row, but in practice doesn't (like with your stackblitz example).
Any progress on this one? As a workaround I re-assign my datasource
Would like to know this as well. Currently experiencing that bug
Any update on this one? It might be an idea to either let the when - function return a boolean (which is not re-evaluated, as it is implemented right now), or return an observable, which will trigger changes in the table if the observable emits a boolean change, maybe even marked with | async ?
Is this to be resolved in the upcoming version 8?
In my case I wanted to implement an infinite scroll, adding new rows at the bottom, but because because of this bug the new rows get broken indexes.
Apart from the missing id="index" attribute I also get the missing class="ng-star-inserted", which means the new rows were ignored my material.

A workaround for this issue is to declare:
@ViewChild(MatTable, {static: false} table: MatTable<any>;
And then use:
this.table.renderRows()
whenever you update the property that when depends on.
Most helpful comment
OH MY GOD!!!! I cannot believe I wasted 2 hours debugging this case which turns out to be a bug. Are there any plans to fix this or maybe there's a workaround to the issue which I haven't thought of?
In our case, we have an
edit buttoninside the table row. When clicked, the button calls a function which sets theindexof the row being edited and that should in theory open thedetailsrow, but in practice doesn't (like with your stackblitz example).