Skip to content

fix(ExportDialogFragment.kt) : TransactionTooLargeException #20984

Merged
BrayanDSO merged 1 commit into
ankidroid:mainfrom
Alok-Silswal:fix-exportdialog-idsfile
May 16, 2026
Merged

fix(ExportDialogFragment.kt) : TransactionTooLargeException #20984
BrayanDSO merged 1 commit into
ankidroid:mainfrom
Alok-Silswal:fix-exportdialog-idsfile

Conversation

@Alok-Silswal
Copy link
Copy Markdown
Contributor

@Alok-Silswal Alok-Silswal commented May 7, 2026

Purpose / Description

Export Dialog crashed when >60k browsed cards are selected and the user puts the app in the background.

One small refactor in FindAndReplaceDialogFragment.kt that was modified to use new extension method for cleanup due to recurring code.

Fixes

Approach

Imitated the approach used in FindAndReplaceDialogFragment.kt to deal with this issue by using class IdsFile rather than using Bundle, which was overflowing when the capacity exceeded, thereby causing the crash.

Used extension method for cleanup operation.

How Has This Been Tested?

Tested on my phone (Android 14, Xiaomi / HyperOS) using a debug build.

I reproduced the issue. It

  • directed me to the main screen: when I waited for some time (maybe 10 seconds or so)
  • showed error/crash: when I re-opened instantly

Both these observations have been tested. Video attached as evidence.

Learning (optional, can help others)

In ExportDialogFragment.kt, there is a scope for code refactoring and cleanup. This would have shrunk this PR by some lines. But I intentionally avioided it in this PR as it do not fit in this scope.

Export_dialog_app_reopen_issue_resolved.mp4

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't handle the case where the IdsFile is deleted, so getIds() fails

Comment thread AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt Outdated
@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label May 7, 2026
Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better!!

Comment thread AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt Outdated
Comment thread AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt Outdated
Copy link
Copy Markdown
Contributor Author

@Alok-Silswal Alok-Silswal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the required changes done!

Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, all are nitpicks. Thanks!!

Comment thread AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt Outdated
Comment thread AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt Outdated
@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge squash-merge A squash & force push is required. The PR author may do this to speed up the merge process. Queued for Cherry Pick to Stable Branch and removed Needs Review Needs Author Reply Waiting for a reply from the original author labels May 12, 2026
@Alok-Silswal Alok-Silswal force-pushed the fix-exportdialog-idsfile branch from 580f6bb to 1a3441c Compare May 13, 2026 06:23
@Alok-Silswal Alok-Silswal force-pushed the fix-exportdialog-idsfile branch from 1a3441c to df1d4f4 Compare May 13, 2026 06:45
@Alok-Silswal
Copy link
Copy Markdown
Contributor Author

I inlined code but when I pushed them they are spreading to multiple lines. I suspect klint is auto-formatting code when I am commiting changes.

Tried this twice.

@Giyutomioka-SS
Copy link
Copy Markdown
Contributor

LGTM!

@BrayanDSO BrayanDSO added this pull request to the merge queue May 16, 2026
@BrayanDSO BrayanDSO added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels May 16, 2026
Merged via the queue into ankidroid:main with commit e963530 May 16, 2026
19 checks passed
@github-actions github-actions Bot removed Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) squash-merge A squash & force push is required. The PR author may do this to speed up the merge process. labels May 16, 2026
@github-actions github-actions Bot added this to the 2.25 release milestone May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when reopening the app with certain dialogs in the browser and >60,000 cards selected

4 participants