Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
@Model
class MyTheme(var primaryColor: Color)
...
val colors = MaterialColors(primary = myTheme.primaryColor)
MaterialTheme(colors) {
}
If 'MaterialTheme' internally uses an ambient, changing myTheme.primaryColor will synchronously cause the ambient value to change and update its consumers. However, if MaterialTheme actually has a @Model class that gets mutated, then this will result in another recomposition for anything consuming that @Model class.
One proposed solution could be knowing that the @Model class is mutated above the scope where it is being consumed, so in the same recomposition pass we can invalidate and recompose anything consuming it.