Skip to content

Fix dashboard infinite spinner after Delete all data - #26

Merged
T0liver merged 1 commit into
mainfrom
c-fix-dashboard-spinner-after-clear-7658
Nov 21, 2026
Merged

T0liver merged 1 commit into
mainfrom
c-fix-dashboard-spinner-after-clear-7658

Conversation

@T0liver

@T0liver T0liver commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Fixes #20

Cause

DashboardViewModel.loadDashboard() cancelled the active flow subscription on every load/refresh and started a new combine() over Room/DataStore sources. After clearing data, the new subscription could fail to complete the combined emission promptly, leaving isLoading = true while recentTastings was already empty — hence the endless spinner until a later DB change (e.g. adding a wine).

Fix

  • Observe dashboard data with a single long-lived combine collection (observeDashboard).
  • Treat pull-to-refresh as a no-op when observation is already active (sources are reactive).
  • Add DashboardViewModelTest covering empty-state loading clearance and ensuring refresh does not re-subscribe.

Test plan

  • ./gradlew assembleDebug testDebugUnitTest (with -Dorg.gradle.jvmargs="-Xmx4g")
Open in Web Open in Cursor 

Keep a single live combine subscription instead of canceling and
re-subscribing on refresh, which could leave isLoading true until the
next DB change.

Co-authored-by: T0liver <T0liver@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Test Results

3 tests  +2   3 ✅ +2   2s ⏱️ +2s
2 suites +1   0 💤 ±0 
2 files   +1   0 ❌ ±0 

Results for commit 2d26016. ± Comparison against base commit c865cc7.

@T0liver
T0liver merged commit 2095602 into main Nov 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Automated test] Dashboard spins forever after "Delete all data"

2 participants