PCIOS-785: iOS: Swipe-to-add-to-Up-Next hangs inside Playlists before the action completes#4678
Draft
pocketcasts wants to merge 1 commit into
Draft
PCIOS-785: iOS: Swipe-to-add-to-Up-Next hangs inside Playlists before the action completes#4678pocketcasts wants to merge 1 commit into
pocketcasts wants to merge 1 commit into
Conversation
… the action completes
Collaborator
Generated by 🚫 Danger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves https://linear.app/a8c/issue/PCIOS-785/ios-swipe-to-add-to-up-next-hangs-inside-playlists-before-the-action
Summary
Fixes a UI hang when swiping episodes in Playlists to add to Up Next. The swipe action would freeze for a noticeable duration before completing, though the add-to-queue operation itself succeeded. This did not happen in podcast show pages or Downloads.
Changes
PlaylistDetailFetchOperation.swift— AddedisCancelledchecks after the database query and inside theDispatchQueue.main.syncblock, matching the pattern used inPodcastEpisodesRefreshOperation. Previously, cancelled operations would still execute the expensive DB query, block onmain.sync, and deliver stale data to the completion handler, stalling the serial operation queue.PlaylistDetailViewModel.swift— Removed the nestedDispatchQueue.main.asyncinside the fetch operation's completion handler. The completion already runs on the main thread (viamain.syncin the operation), so the nested async dispatch deferred the DifferenceKit changeset computation to a later run-loop cycle with potentially stale data. This could cause batch update failures that fell back toreloadData()during SwipeCellKit's editing animation, freezing the UI. The podcast page equivalent runs this work synchronously without issue.Verification
Confidence
MEDIUM — The root cause analysis is well-supported by comparing the playlist path with the working podcast page path (which has proper isCancelled checks and no nested main.async). The fix aligns both paths. However, the original report could not be reproduced by the HE on a newer device, so the hang may be data-size or device-speed dependent, making it difficult to verify the fix without the reporter's specific playlist data.
This PR was created autonomously by linear-solver.
Triage complexity: medium | Linear issue