Skip to content

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
devin/1763648547-fix-record-hook-commit-completion
Closed

fix(record-hook): complete commit after successful record updates when trackChanges is enabled#869
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1763648547-fix-record-hook-commit-completion

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where commit:completed events were not firing when trackChanges was enabled and records were successfully updated by a bulkRecordHook.

Problem

The bulkRecordHook was calling completeCommit() in three scenarios:

  1. When there are no records to process (line 80)
  2. When no records were modified (line 119)
  3. When an error occurred (line 140)

However, it was missing the call to completeCommit() after successfully updating modified records (line 131). This caused:

  • The commit:completed event to never fire when records were actually updated
  • The UI submit button to become clickable before record hooks finished processing
  • Workbook actions not being properly gated when trackChanges: true was set

Solution

Added await completeCommit(event, debug) after the successful event.update() call to ensure commits are completed in all scenarios when trackChanges is enabled.

Please explain how to summarize this PR for the Changelog:

Fixed bulkRecordHook to properly emit commit:completed events when trackChanges is enabled and records are successfully updated.

Tell code reviewer how and what to test:

Critical Review Points:

  1. Double-completion safety: Verify that completeCommit() in record.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.

  2. Event flow verification: Consider whether event.update() might already trigger commit completion through the Platform's updateRecords() logic when forEvent is passed. If so, this change should still be safe due to error handling, but worth verifying.

  3. Test coverage: The existing e2e tests pass, but they may not specifically cover the trackChanges + commit:completed flow. Consider if additional test coverage is needed.

Manual Testing:
To verify this fix works:

  1. Create a workbook with settings: { trackChanges: true }
  2. Add a bulkRecordHook that modifies records
  3. Add a listener for commit:completed event
  4. Verify that commit:completed fires after the hook completes
  5. Verify that workbook actions are properly gated until the commit completes

Related Issue:
This addresses a customer-reported issue where trackChanges was not preventing the submit button from becoming clickable while bulkRecordHook was still processing records.


Link to Devin run: https://app.devin.ai/sessions/5bf90d949cec4754bcb4062467db992d
Requested by: christopher.harrison@flatfile.io (@cnharrison)

…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>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration
Copy link
Copy Markdown
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.

@promptless
Copy link
Copy Markdown

promptless Bot commented Nov 20, 2025

📝 Documentation updates detected!

New suggestion: Add changelog entry for record-hook commit:completed fix

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