-
Notifications
You must be signed in to change notification settings - Fork 55
Don't wait to return empty #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds early-return guards in updateDocument to short-circuit when the old or resulting document is empty, shifts the emptiness check into the transaction, and emits DOCUMENT_DELETE events only when a deletion actually occurred. No public signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant DB as Database
participant Tx as Transaction
Caller->>DB: updateDocument(collectionId, documentId, data)
DB->>Tx: begin transaction
Tx->>Tx: read old document
alt old document is empty (new in-tx guard)
Tx-->>DB: return empty Document
DB-->>Caller: empty Document
else old document exists
Tx->>Tx: apply updates
Tx-->>DB: updated Document (may be empty)
DB->>DB: post-transaction guard checks `$document->isEmpty()`
alt updated document is empty
DB-->>Caller: empty Document
else
DB->>DB: populate relationships & decode
DB-->>Caller: updated Document
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
Summary by CodeRabbit