| Metadata | Value |
|---|---|
| Status | Completed |
| Version | 1.0.0 |
| Last Updated | 2026-11-02 |
| Author | Sangeetha Grantha Team |
ID: TRACK-155 Status: Completed (PR #59; follow-ups listed in the Progress Log) Owner: Seshadri Created: 2026-11-01 Updated: 2026-11-02
Make the Rasika kshetra screens behave well with real data: the Kshetras list keeps its place after back navigation, and the Tiruvarur detail (114 kritis) scrolls like a normal list.
modules/shared/presentation/.../kshetra/KshetraScreens.kt, .../RasikaApp.kt (navigation host), .../navigation/RasikaDestination.kt. Conventions: kmp-compose-mobile skill.Status: Accepted Accepted by: Seshadri Accepted at: 2026-11-02
Found while walking TRACK-151 in the iOS simulator (iPhone 17, iOS 27.2):
01930000-0000-7000-8000-000000000001: 114 direct kritis, 10 child shrines) is one very long list, and the scroll keeps moving long after a swipe has ended.Rasika users on iOS and Android. Module modules/shared/presentation only, unless Spec item 8 chooses paging (then the V2 temple detail endpoint, DTOs and OpenAPI as well).
Status: Accepted Accepted by: Seshadri Accepted at: 2026-11-02
Written from code reading and a live database query on 2026-11-01. The simulator was not driven in this drafting session, so the cause of defect 2 is a code-based hypothesis; Plan step 1 measures it before any change.
RasikaApp (remember { KshetraListPresenter(...) }), so the loaded list and the element filter survive back navigation. The scroll position does not: KshetrasScreen uses Modifier.verticalScroll(rememberScrollState()) inside LoadStateContent, and RasikaApp renders destinations with AnimatedContent, whose contentKey for Kshetras is the class name. Navigating to KshetraDetail removes the list from composition, so its ScrollState is discarded; on back, a new ScrollState starts at 0.CollectionsScreen (verticalScroll(rememberScrollState())) and BrowseScreen/FavouritesScreen/SearchScreen (LazyColumn, unhoisted state) are built the same way inside the same AnimatedContent, so they should reset too. Plan step 1 confirms this in the simulator. There is therefore no existing “good” list to copy; the fix sets the convention.KshetraDetailScreen is a plain Column with verticalScroll, not a lazy list: all 114 KritiRows (each with RasikaPressable, semantics and a RagaSequence), the 10 child rows and the facts compose and lay out at once. That is a cost on open and for every re-measure. The “keeps moving” symptom may instead be the iOS fling deceleration over a very long content height rather than a frame drop. Step 1 measures both (frame times or a profiler trace, and a screen recording) and the fix is judged against the measurement.temple_id): only 1 temple has 50 or more direct kritis, the maximum is 114 (Tiruvarur), the 90th percentile is 10. Payload size and server time for the Tiruvarur detail are not measured yet (no backend was running on 8080); Plan step 1 records them.RasikaApp (a ScrollState for the list; a LazyListState for the detail), passed as parameters with a default so previews and tests still work. Smallest change; touches KshetraScreens.kt and RasikaApp.kt. Option B: wrap the AnimatedContent content in a SaveableStateHolder keyed by contentKey, which restores rememberSaveable state (including rememberScrollState and rememberLazyListState) for every Rasika screen, and remove saved state when a destination is popped. Fixes Collections, Browse and others at once, but changes every screen and needs a leak/reset rule (stack depth is bounded at 8). Recommendation: A in this track; B recorded as a separate follow-up if Step 1 confirms the others reset.KshetraDetailScreen renders its content as one LazyColumn: header items (overview, map link, parent, facts), the shrine rows, then items(detail.krithis, key = { it.id.toString() }). Visual design, copy, order, headings semantics and content descriptions are unchanged. Only visible rows are composed.GET /v2/catalogue/temples/{id}. Reason: the measured maximum is 114 rows for one temple; with a lazy list, cost scales with what is on screen, not with row count; changing the contract would affect TRACK-152 and TRACK-153 consumers and OpenAPI for no measured gain. Revisit trigger: any temple above about 300 direct kritis, or a measured payload above about 250 KB, after which a page parameter is proposed in a new track. If step 1 shows payload size or server time is the real cost, this item is reopened and the Plan changes.RasikaApp creates val kshetraListScroll = rememberScrollState() and val kshetraDetailScroll = rememberLazyListState() next to the kshetra presenters and passes them to the screens. Because RasikaApp stays in composition for the whole session, the states outlive the AnimatedContent content.LazyListState is shared by every KshetraDetail destination, which would carry one temple’s offset into another (parent to child and back). So the detail state is kept per temple id: remember { mutableStateMapOf<Uuid, LazyListState>() } filled on first visit and capped by the bounded stack depth, or the offset is saved on leave and restored on return (Plan chooses; a test pins that opening temple B does not start scrolled).KshetrasScreen calls scrollTo(0) in a LaunchedEffect(state.element) skipped on first composition.LoadStateContent already wraps the content slot; the lazy list replaces the inner Column and keeps Modifier.fillMaxSize(). Section labels become full-width items (key-prefixed strings) so heading() semantics stay.RasikaNavigator.open ignores a repeated destination and caps depth at 8; no change, but the tests exercise Kshetras to Detail to Detail to back to back.carnatic-musicologist review not needed.Intent 1 (scope A or B) and Intent 2 (back only, or also fresh visits). The Spec assumes A and back-only until answered.
Status: Accepted Accepted by: Seshadri Accepted at: 2026-11-02
Accepted 2026-11-02; implementation may start. Open questions are answered as the Spec assumed (Option A, kshetra-only; back-only restore).
| Path | Change |
|---|---|
modules/shared/presentation/.../kshetra/KshetraScreens.kt |
KshetrasScreen takes a hoisted ScrollState; filter change resets it. KshetraDetailScreen becomes a LazyColumn with a hoisted/per-temple LazyListState; stable keys |
modules/shared/presentation/.../RasikaApp.kt |
Own the scroll states beside the kshetra presenters and pass them down |
modules/shared/presentation/src/commonTest/.../kshetra/KshetraScrollStateTest.kt (new) |
Per-temple state holder tests (see Tests) |
conductor/tracks/evidence/TRACK-155/ (new) |
Step 1 measurements and simulator evidence notes |
conductor/tracks.md |
Status only |
No backend, DAL, OpenAPI, migration, domain DTO, or Python change (unless step 1 reopens Spec item 8).
make mobile-ios; start the backend only if none answers on 8080 (the main stack database sangeetha-grantha-db-1 is on 5432; do not stop a backend this work did not start). On iPhone 17 / iOS 27.2: record the baseline for (a) list back-navigation reset, (b) Collections and Browse back-navigation reset, (c) Tiruvarur detail back from a kriti, (d) Tiruvarur open time and fling behaviour (screen recording plus frame time or Instruments trace), (e) curl payload size and time for the Tiruvarur detail. Write results to the Progress Log and evidence/TRACK-155/. Revisit the Spec if (d) or (e) contradict the hypothesis.Steps 2 and 3 can land as separate commits; step 1 first.
KshetraPresentersTest already pins that the list loads once and the filter survives a refresh; add one case that loadIfNeeded() called again after re-entering the screen does not refetch and keeps element.KshetraScrollStateTest covers the per-temple state holder: opening temple A, scrolling, opening B starts at the top, returning to A restores A’s offset, and the holder stays within the stack-depth bound.modules/shared/presentation has no Compose UI-test dependency today. The Plan adds compose.uiTest for the host/JVM target and a test that composes KshetrasScreen with a fixture list, scrolls, simulates navigating away and back via RasikaApp with the RasikaUiTestHarness fake API, and asserts the offset; and a Tiruvarur-fixture test that only a bounded number of KritiRows are composed at once. If the dependency cannot be added to this module without a version-catalog change, the Plan stops and asks (versions go through gradle/libs.versions.toml and current-versions.md), and the simulator walk-through below becomes the proof for the UI behaviour.make test, ./gradlew :modules:shared:presentation:allTests, Android assemble per CI, make check-docs, git diff --check.make mobile-ios)Each as a short recording or paired screenshots saved under conductor/tracks/evidence/TRACK-155/, with the commands used:
LazyListState leaks one temple’s offset into another; mitigated by the per-temple holder and its test.RasikaApp grows an already large function; acceptable for two states, noted if Option B is later chosen.AnimatedContent crossfade over a LazyColumn could flash an empty list on return; the simulator walk-through (item 1) checks it.Step 1 baseline numbers, the six simulator items above, the new unit and UI tests green, make test output, make check-docs, and CI green on the PR.
LazyColumnKshetraScreens.kt, RasikaApp.kt, RasikaDestination.kt) and one database query (1 temple with 50 or more direct published kritis; maximum 114; 90th percentile 10). No simulator run, no application code changed. Waiting for Seshadri to accept Intent, then Spec, then Plan.KshetraScrollStates (new, owned by RasikaApp) holds the list ScrollState and one LazyListState per temple, and sync() drops positions whose screen has left the stack, so only back restores. KshetrasScreen takes the hoisted state and scrolls to the top when the element filter changes. KshetraDetailScreen is now one LazyColumn with stable keys; copy, order and semantics are unchanged. No presenter, backend, OpenAPI or data change.GET /v2/catalogue/temples/{Tiruvarur} = 44,169 bytes in 85 ms (warm, one request), so the payload and server are not the cost; the Spec 8 decision (no page parameter) stands. Before the fix, back from a temple put the list at the top (screenshots in evidence/TRACK-155/).KshetraScrollStatesTest (6) and one new KshetraPresentersTest case; make test and make test-mobile pass.compose.uiTest dependency and adding one needs a version-catalog change, which the Plan said to ask about first; the holder logic is unit tested and the walk-through covers the rest. (5) The detail screen still reloads the temple when re-entered (skeleton flash) because KshetraDetailPresenter.open always refetches; position is restored regardless. Also seen, unrelated: Explore search showed “Could not reach the catalogue” for “Tiruvarur” while the temple endpoints answered.