mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-04 21:02:35 +08:00
When the SDK sends identify calls with identical payloads (common on every page load), `save!` fires even though no attributes changed. While Rails skips the actual UPDATE SQL, it still opens a transaction, runs all callbacks (including validation queries like `Contact Exists?`), and triggers `after_commit` hooks — all for a no-op. This adds a `changed?` guard before `save!` to skip it entirely when no attributes have actually changed. **How to test** - Trigger an identify call via the SDK with a contact's existing attributes (same name, email, custom_attributes, etc.) - The contact should not fire a save (no transaction, no callbacks) - Trigger an identify call with a changed attribute — save should work normally **What changed** - `ContactIdentifyAction#update_contact`: guard `save!` with `changed?` check - Added specs to verify `save!` is skipped for unchanged params and avatar job still enqueues independently |
||
|---|---|---|
| .. | ||
| contact_identify_action_spec.rb | ||
| contact_merge_action_spec.rb | ||