Skip to content

Perf: @Immutable on MovieListItem + rail data classes (skip rail recomposition) #44

Description

@Yokomoko

From: review-reports/kotlin-idioms.md finding #14

Where: data/db/Entities.kt (MovieListItem); ui/home/HomeViewModel.kt (HomeGenreRail, HomeProviderRail)

Issue: MovieListItem is a plain data class — no Compose stability annotation. It appears in List<MovieListItem> parameters passed to composables throughout HomeScreen and MoviesScreen. Compose compiler can't verify List<T> stability and marks these as unstable, forcing full recomposition of every card rail whenever the parent recomposes.

With 8+ rails × 20 cards each, instability cascades into significant recomposition work on every sync progress update or hero carousel tick.

Fix: Annotate MovieListItem, HomeGenreRail, HomeProviderRail with @Immutable after wrapping List fields in kotlinx.collections.immutable.ImmutableList (or accept the List stability caveat and use @Immutable anyway since we don't mutate the lists).

User impact: smoother home screen during enrichment — less recomposition work per frame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsecondary-priorityHigh value — noticeably improves the experience

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions