Skip to content

Avoid reloading and remeshing strokes on every Room note update. - #130

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1022860218
Nov 20, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1022860218

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Avoid reloading and remeshing strokes on every Room note update.

Because strokes are stored on the notes row, saving finished strokes re-triggered getNoteStream(noteId) in both DrawingCanvasViewModel and any backstack HomeScreenViewModel, causing both ViewModels to re-decode JSON and regenerate native Stroke meshes on the main thread after every stroke.

Load initial strokes only once in DrawingCanvasViewModel so subsequent Note emissions update metadata without re-decoding or replacing in-memory Stroke instances, and defer stroke reloads in HomeScreenViewModel while uiState has no active UI subscribers.

Selecting a different note on the Home screen now clears the previous note's strokes immediately, so the preview is briefly empty while the new note loads.

@copybara-service
copybara-service Bot force-pushed the test_1022860218 branch 2 times, most recently from acc989f to ce058c2 Compare November 20, 2026 15:11
Because strokes are stored on the `notes` row, saving finished strokes re-triggered `getNoteStream(noteId)` in both `DrawingCanvasViewModel` and any backstack `HomeScreenViewModel`, causing both ViewModels to re-decode JSON and regenerate native `Stroke` meshes on the main thread after every stroke.

Load initial strokes only once in `DrawingCanvasViewModel` so subsequent `Note` emissions update metadata without re-decoding or replacing in-memory `Stroke` instances, and defer stroke reloads in `HomeScreenViewModel` while `uiState` has no active UI subscribers.

Selecting a different note on the Home screen now clears the previous note's strokes immediately, so the preview is briefly empty while the new note loads.

PiperOrigin-RevId: 1026458631
@copybara-service
copybara-service Bot merged commit b5b23c7 into main Nov 20, 2026
5 checks passed
@copybara-service
copybara-service Bot deleted the test_1022860218 branch November 20, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant