fix(record-hook): complete commit after successful record updates when trackChanges is enabled#869
Closed
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Closed
Conversation
…n trackChanges is enabled The bulkRecordHook was calling completeCommit in three scenarios: 1. When there are no records to process 2. When no records were modified 3. When an error occurred However, it was missing the call to completeCommit after successfully updating modified records. This caused the commit:completed event to never fire when trackChanges was enabled, preventing the UI from properly gating submit actions until all record hooks completed. This fix adds the missing completeCommit call after successful record updates, ensuring that commit:completed fires in all scenarios when trackChanges is enabled. Co-Authored-By: christopher.harrison@flatfile.io <cnharrison@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
|
Closing this PR after further investigation. The original design intentionally did not call completeCommit after successful updates, suggesting event.update() should handle this automatically. Need to investigate the specific issue more carefully rather than assuming the plugin is broken for everyone. |
|
📝 Documentation updates detected! New suggestion: Add changelog entry for record-hook commit:completed fix |
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.
Summary
Fixes a bug where
commit:completedevents were not firing whentrackChangeswas enabled and records were successfully updated by abulkRecordHook.Problem
The
bulkRecordHookwas callingcompleteCommit()in three scenarios:However, it was missing the call to
completeCommit()after successfully updating modified records (line 131). This caused:commit:completedevent to never fire when records were actually updatedtrackChanges: truewas setSolution
Added
await completeCommit(event, debug)after the successfulevent.update()call to ensure commits are completed in all scenarios whentrackChangesis enabled.Please explain how to summarize this PR for the Changelog:
Fixed
bulkRecordHookto properly emitcommit:completedevents whentrackChangesis enabled and records are successfully updated.Tell code reviewer how and what to test:
Critical Review Points:
Double-completion safety: Verify that
completeCommit()inrecord.utils.ts(lines 126-131) properly handles "Commit already completed" errors without throwing. This is important because the Platform may also auto-complete commits in some scenarios.Event flow verification: Consider whether
event.update()might already trigger commit completion through the Platform'supdateRecords()logic whenforEventis passed. If so, this change should still be safe due to error handling, but worth verifying.Test coverage: The existing e2e tests pass, but they may not specifically cover the
trackChanges + commit:completedflow. Consider if additional test coverage is needed.Manual Testing:
To verify this fix works:
settings: { trackChanges: true }bulkRecordHookthat modifies recordscommit:completedeventcommit:completedfires after the hook completesRelated Issue:
This addresses a customer-reported issue where
trackChangeswas not preventing the submit button from becoming clickable whilebulkRecordHookwas still processing records.Link to Devin run: https://app.devin.ai/sessions/5bf90d949cec4754bcb4062467db992d
Requested by: christopher.harrison@flatfile.io (@cnharrison)