fix: avoid TransactionTooLargeException with many-field note types#21295
Open
criticalAY wants to merge 1 commit into
Open
fix: avoid TransactionTooLargeException with many-field note types#21295criticalAY wants to merge 1 commit into
criticalAY wants to merge 1 commit into
Conversation
FieldEditLine.onSaveInstanceState() froze its entire child view hierarchy and Java-serialized the expansion enum, costing ~1.2 KB per field even when the field was empty. A note type with 400 fields serialized to ~500 KB of view state, which exceeded the Binder transaction limit when the activity was stopped (backgrounded or a preview opened), crashing with TransactionTooLargeException. Assisted-By: Claude Opus 4.8 (tests)
Collaborator
|
Did you reproduce the bug? The note type in the shared deck has only about 200 fields and it didn't crash the app by leaving or previewing. |
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.
Note
Assisted by Opus 4.6 for tests (test)
Purpose / Description
A note type with a very large number of fields (e.g. ~400) crashes the note editor with
TransactionTooLargeExceptionwhen the editor is stopped i.e. when the app is backgrounded or the previewer is opened so this PR fixes thatFixes
Approach
FieldEditLinenow persists only the essential, user-editable statename,content,ordandexpansionStatethrough a compact@Parcelize SavedState, instead of freezing the whole child view subtree and Java-serializing the enum.How Has This Been Tested?
Unit test and Pixel 10 wasn't able to reproduce the error
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.