fix(media-list): preserve ordering, viewport, notes field, and next-airing state on entry updates - #1131
Open
wax911 wants to merge 4 commits into
Open
fix(media-list): preserve ordering, viewport, notes field, and next-airing state on entry updates#1131wax911 wants to merge 4 commits into
wax911 wants to merge 4 commits into
Conversation
Updates to a list entry no longer remove and re-append its ID, which reshuffled API-preserved ties. The updated ID keeps its slot before a stable re-sort, ADDED_TIME and UPDATED_TIME now compare the server createdAt/updatedAt carried by MediaListCoreFragment instead of the local request revision, and revision remains the stale-response guard only.
The manage sheet now emits mutation-started and mutation-failed fragment results keyed by media ID. MediaListFragment captures the first visible media ID, decorated top offset, target baseline revision, and predecessor identities before a mutation, waits for the store to commit a higher revision or drop the target from the filter, then restores the recorded anchor through the adapter final submitList commit callback. Failed mutations clear only the matching pending anchor, and shared increment dispatch (including AiringListFragment) captures the same anchor.
The section label and the TextInputLayout hint rendered the same prompt and overlapped entered text. The static MaterialTextView is removed so the outlined text field hint is the single placeholder owner, matching the BottomSheetSeriesManage reference design.
When a successful save returns media without nextAiringEpisode (seen on RELEASING titles), the interactor now fetches getMediaWithList by the authoritative mediaId, re-validates the mutation session, and merges only the refreshed nextAiringEpisode into the committed record, so the row leaves Releasing without an app restart. Failed refreshes do not invalidate the committed mutation.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 24 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
AniTrend Pull Request
Thank you for contributing! Please take a moment to review our contributing guidelines
to make the process easy and effective for everyone involved.
Please open an issue before embarking on any significant pull request, especially those that
add a new library or change existing tests, otherwise you risk spending a lot of time working
on something that might not end up being merged into the project.
Before opening a pull request, please ensure you've done the following:
developand targetsdevelop(where applicable)Description
Fixes four reported regressions in the media-list entry update flow. Branch is based on and targets
develop.1. Visible list order changed after an entry update.
InMemoryMediaListStore.updateQueryMembershipremoved the updated entry ID and re-appended it, which reshuffled API-preserved ties and moved rows even when the active sort was server-ordered. The updated ID now keeps its slot before a stable re-sort, andADDED_TIME/UPDATED_TIMEcomparators use the servercreatedAt/updatedAtvalues (added toMediaListCoreFragment,MediaListRecord, and the collection and mutation mappers) instead of the local requestrevision.revisionremains only the stale-response guard.2. Viewport moved away from the edited item.
BottomSheetSeriesManagenow emits mutation-started and mutation-failed fragment results keyed by media ID.MediaListFragmentcaptures the first visible media ID, decorated top offset, edited-entry baseline revision, and predecessor identities before a mutation, waits until the store commits a higher revision or the target leaves the active filter, and restores the recorded anchor through the adapter's finalsubmitListcommit callback (after the two-stage filter + diff). Failed mutations clear only the matching pending anchor. Shared increment dispatch (used byAiringListFragment) captures the same anchor. NonotifyDataSetChanged, no object-identity keys, no newKeyUtil.*_REQrouting.3. Comment placeholder overlapped entered text.
The notes card rendered both a static
section_noteslabel and the outlined text-field hint. The duplicateMaterialTextViewis removed; theTextInputLayouthint (dialog_hint_enter_your_notes) is the single placeholder owner, consistent with theBottomSheetSeriesManagereference design.4. Next-airing label stayed at
Releasinguntil app restart.When a successful save returns media without
nextAiringEpisode(observed forRELEASINGtitles),SaveMediaListEntryInteractornow performs a serialgetMediaWithListfetch by the authoritativemediaId, re-validates the mutation session, and merges only the refreshednextAiringEpisodeinto the committed record in the same upsert. A failed refresh does not invalidate the committed mutation, and no client-side dates are synthesized.Invariants and compatibility
copyof the existing summary), so mutation-supplied fields such as banner image and site URL are retained.RecyclerViewAdapterandKeyUtil.*_REQrouting untouched.Files changed
app/src/main/graphql/fragments/medialist/MediaListCoreFragment.graphql(addcreatedAt)app/src/main/java/com/mxt/anitrend/domain/medialist/model/MediaListRecord.ktapp/src/main/java/com/mxt/anitrend/data/mapper/MediaListRecordMapper.ktapp/src/main/java/com/mxt/anitrend/data/mapper/MediaListCollectionRecordMapper.ktapp/src/main/java/com/mxt/anitrend/repository/mapper/BrowseMapper.ktapp/src/main/java/com/mxt/anitrend/data/store/medialist/InMemoryMediaListStore.ktapp/src/main/java/com/mxt/anitrend/domain/medialist/interactor/SaveMediaListEntryInteractor.ktapp/src/main/java/com/mxt/anitrend/adapter/recycler/index/MediaListAdapter.ktapp/src/main/java/com/mxt/anitrend/view/fragment/list/MediaListFragment.ktapp/src/main/java/com/mxt/anitrend/view/sheet/BottomSheetSeriesManage.ktapp/src/main/res/layout/sheet_series_manage_m3.xmlMediaListStoreTest.kt,SaveMediaListEntryInteractorTest.kt,BrowseMediaListCollectionRepositoryTest.kt(fixture field)Tests added
entry update reorders added-time sorts using server timestamps(red-first: failed before comparator fix)entry update reorders updated-time sorts using server timestamps(red-first)entry update preserves API order for equal updated-time keys(red-first:thenBy(mediaId)tie-break reshuffle)successful save with missing airing data commits refreshed next-airing episode(red-first: failed pre-fix withexpected 12 but was null)Verification commands executed
./gradlew :app:testAppDebugUnitTest --tests com.mxt.anitrend.data.store.MediaListStoreTest --tests com.mxt.anitrend.domain.medialist.interactor.SaveMediaListEntryInteractorTest(all pass)./gradlew test --no-daemon(full unit suite, all pass)./gradlew :app:spotlessCheck --no-daemon(pass)./gradlew :app:assembleAppDebug :app:assembleGithubDebug --no-daemon(pass, APKs produced)spotlessCheck testplus both flavor builds exit 0Known limitations
nextAiringEpisode, the row keepsReleasing; no client-side date is guessed.Follow-ups
app/.meta/version.jsonminSdk mismatch (existing automation issue, untouched here).Rollback procedure
Revert the four commits (
d585aaa42,b637c2ce6,a54cf8555,9255401e5); no schema, migration, or persisted-state changes are involved, so a plain revert restores prior behavior.Screenshots:
Live UI captures pending; offline verification evidence is in the description above.
Types of changes
IMPORTANT: By submitting a patch, you agree to allow the project
owners to license your work under the terms of the MIT License.