Files
music_library/backlog/tasks/ml-169.9 - Fix-Full-stream-resets-on-pagination-within-same-search.md
T
2026-05-19 12:51:29 +01:00

2.0 KiB

id, title, status, assignee, created_date, labels, dependencies, references, modified_files, parent_task_id, priority, ordinal
id title status assignee created_date labels dependencies references modified_files parent_task_id priority ordinal
ML-169.9 Fix: Full stream resets on pagination within same search To Do
2026-05-19 11:48
perf
fix
backlog/documents/doc-27 - Phase-4-Performance-Audit-Low-Hanging-Fruit-Findings.md
lib/music_library_web/live_helpers/index_actions.ex
lib/music_library_web/live/scrobbled_tracks_live/index.ex
lib/music_library_web/live/artist_live/show.ex
ML-169 medium 30000

Description

Optimize stream behavior so that pagination within the same search does not trigger a full stream(..., reset: true). Search and order changes still legitimately need resets.

Problem

Every search query change, order toggle, or pagination click triggers a full stream(..., reset: true). While reset: true is correct when the entire dataset changes (new search query), it's unnecessary for pagination within the same search — the existing items don't change, only new ones are appended.

Files

  • lib/music_library_web/live_helpers/index_actions.ex:89load_and_assign_records uses reset: true
  • lib/music_library_web/live/scrobbled_tracks_live/index.ex:334load_and_assign_tracks uses reset: true
  • lib/music_library_web/live/artist_live/show.ex:698-699assign_records uses reset: true

Fix

Use stream(..., at: -1) (append) for "load more" pagination. Only use reset: true when search text or order field changes. This requires distinguishing between a "new search" and "same search, next page" in the pagination handler.

Acceptance Criteria

  • #1 Pagination to next page appends records without full stream reset
  • #2 Existing stream items remain visible during pagination
  • #3 Search query change still triggers full stream reset
  • #4 Order change still triggers full stream reset
  • #5 No duplicate records appear after multiple pagination clicks