Skip to content

fix(firestore): read old_value for delete events in onDocumentDeleted handler#57

Merged
Lyokone merged 15 commits intomainfrom
fix-doc-deleted
Mar 3, 2026
Merged

fix(firestore): read old_value for delete events in onDocumentDeleted handler#57
Lyokone merged 15 commits intomainfrom
fix-doc-deleted

Conversation

@demolaf
Copy link
Copy Markdown
Member

@demolaf demolaf commented Feb 27, 2026

Changes

_registerDocumentHandler() was unconditionally reading parsed?['value'] (the post-write state) for all event types, but for delete events the pre-deletion document is in parsed?['old_value'] — causing event.data to always be null in onDocumentDeleted handlers. Fixed by selecting the field based on the method name.

Testing

Added a test that checks the emulator logs in 'onDocumentDeleted fires with final document state' e2e test to verify event.data is not null.

@demolaf demolaf marked this pull request as draft February 27, 2026 08:23
@demolaf demolaf changed the title fix: parsing old_value onDocumentDeleted fix(firestore): read old_value for delete events in onDocumentDeleted handler Feb 27, 2026
@demolaf demolaf marked this pull request as ready for review February 27, 2026 11:24
demolaf and others added 2 commits February 27, 2026 16:31
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
@Lyokone Lyokone merged commit b5d33b2 into main Mar 3, 2026
7 checks passed
@Lyokone Lyokone deleted the fix-doc-deleted branch March 3, 2026 15:44
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.

2 participants