Pick the fix
Each feed row calls items.sortedBy { it.date } and formats dates inside the composable. What's the best fix?
Hint 1 of 1
How often does this work run?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Sort and format once in the ViewModel, and pass ready UI models to rows
Correct. Work happens once per data change, not per recomposition.
Why not the others?
- B Wrap each row in remember. Rows still recompute when their inputs change, and it doesn't move the sort.
- C Use a bigger thread pool. Composition runs on the main thread.
- D Disable animations. Unrelated.