Skip to content

fix(SetDueDateDialog) : TransactionTooLargeException#21055

Open
Alok-Silswal wants to merge 1 commit into
ankidroid:mainfrom
Alok-Silswal:fix-setduedate-idsfile
Open

fix(SetDueDateDialog) : TransactionTooLargeException#21055
Alok-Silswal wants to merge 1 commit into
ankidroid:mainfrom
Alok-Silswal:fix-setduedate-idsfile

Conversation

@Alok-Silswal
Copy link
Copy Markdown
Contributor

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

Purpose / Description

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

Fixes

Approach

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

Modified newInstance API in unit tests to make it consistent with the approach used in this PR.

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.

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
SetDueDate.Fix.Evidence.mp4

@Alok-Silswal Alok-Silswal marked this pull request as draft May 16, 2026 17:59
@david-allison
Copy link
Copy Markdown
Member

david-allison commented May 17, 2026

merged! Please rebase + remove the merge commits in the history

@Alok-Silswal Alok-Silswal force-pushed the fix-setduedate-idsfile branch 2 times, most recently from 4d601f6 to bb13e23 Compare May 18, 2026 18:14
@Alok-Silswal Alok-Silswal force-pushed the fix-setduedate-idsfile branch from bb13e23 to f87854e Compare May 18, 2026 18:17
@Alok-Silswal Alok-Silswal marked this pull request as ready for review May 18, 2026 18:18
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.

One issue with the file being deleted, rest are ignorable

)
Timber.i("Showing 'set due date' dialog for %d cards", cardIds.size)
}
suspend fun newInstance(
Copy link
Copy Markdown
Member

@david-allison david-allison May 18, 2026

Choose a reason for hiding this comment

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

nit: If you add an overload with context(fragment: Fragment), you should be able to keep the call sites clean

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewModel.init(cardIds, fsrsEnabled)
viewModel.init(cardIds.toLongArray(), fsrsEnabled)
Copy link
Copy Markdown
Member

@david-allison david-allison May 18, 2026

Choose a reason for hiding this comment

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

nit: why not change the signature of init

get() = requireArguments().requireBoolean(ARG_FSRS)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🐉 You now need to handle the fact that cardIds does not exist because the file was deleted

@lukstbit lukstbit added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Author Reply Waiting for a reply from the original author

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

3 participants