{
  "id": 23780603,
  "title": "How to Add Bulk Actions Without Breaking Half Your Data",
  "url": "https://urgent.news/2026/12/06/how-to-add-bulk-actions-without-breaking-half-your-data",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-06T06:30:12.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/wizcodes/how-to-add-bulk-actions-without-breaking-half-your-data-2bpg"
  },
  "original_language": null,
  "account": "Bulk actions can be implemented in two main ways: synchronously or asynchronously. Synchronous bulk actions loop through each item in a single process, committing or rolling back all changes together. This approach works well for small batches where the user waits only a short time for the operation to complete. However, larger batches can cause timeouts or leave data partially updated if an error occurs.\n\nAsynchronous bulk actions use queues to process items one at a time in the background. This allows the user to see immediate results for the first few items while remaining confident that the remaining items will be handled correctly, even if some fail. Key considerations include handling partial failures, user wait time expectations, and dependencies between records.\n\nWhen implementing bulk actions, focus on three main questions:\n1. What happens when an individual item fails? Do you roll back the entire batch or continue with the other items? This depends on whether the operation affects external systems or stays within your database.\n2. How long the user needs to wait for the results. If the user wants instant feedback, a transactional approach is suitable. For larger batches where the user can wait, asynchronous processing is better.\n3. The relationship between operations. If one action impacts other records (e.g., updating task statuses dependent on task dependencies), treat them as a single unit to avoid cascading failures.\n\nFor practical implementation, build your bulk actions around partial failure handling. Validate the entire batch before making any changes, wrap each operation in its own transaction, and return structured results showing success counts and individual error details for failed items. This allows users to see exactly which items failed and why.\n\nQueue-based processing is recommended for operations that take longer than a few seconds or require retry logic. For operations completed within a couple of seconds, handle them synchronously to provide immediate feedback to the user. Before implementing bulk actions, validate your database's ability to handle partial writes, ensure you can track which items failed and why, and plan for pending work if the operation times out. Monitor operation throughput, partial-failure recovery, and user feedback latency to ensure your system works as intended.",
  "summary": "Most teams add bulk actions by wrapping single-operation logic in a loop. Then they watch it time out on 500 items or leave half the records broken when one fails. The architecture decision is which operations get a queue and which get transactional rollback. That depends on whether the operation talks to external systems or stays inside your database boundary. What actually decides the answer…",
  "summary_source": "publisher",
  "key_points": [],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}