RFC 0087 — Many rows deleted: the selection's Delete, asked once, sent in chunks
Status: implemented (2026-11-30) · Target: 0.66.0 · builds on RFC 0077, RFC 0084 and RFC 0086 · see Decisions
Summary
"Delete the 340 drafts." The user filters, selects every match (RFC 0077),
and then writes a bulk action: a button, a confirm, a loop over the ids
calling _destroy one at a time, a toast, the selection cleared. Every
app writes it, and over a backend it's 340 requests. RFCs 0084 and 0086
did this for setting a column; this RFC does it for deleting.
<Table page={list} bind:query select every={...} ondeletemany={(ids) => api.invoices_destroy_many(ids)} />
- Delete in the selection bar, with
ondeletemany(ids): asked once ("Delete 340 invoices? This can't be undone."), then sent in chunks of 500, with RFC 0079's progress and Cancel. - What's left: rows the command refuses (
failed) stay selected and are said; the deleted ones leave the selection and the list. make:resourcewrites{p}_destroy_many(ids)(each row's ability, soft deletes as_destroyhas them, one statement), and over a backendDELETE /api/{p}with{ ids }, answered by the package'selyraDestroyMany.
Motivation
- The second bulk action every list has. After "set a column" (RFC 0080), it's "delete these". Every app writes the same snippet.
- A loop of single deletes is slow and half-done. 340 requests over a backend; a failure halfway leaves the user guessing which went.
- The pieces exist: the selection with every match (RFC 0077), the chunks, progress and Cancel (RFC 0084), the package's per-row policy answer (RFC 0086).
Current state (0.66)
- The selection bar shows the count, Select all N that match, Set
(RFC 0080), the app's
bulk(selected, clear)and Clear. make:resourcewrites{p}_destroy(id)(soft when the model hassoft_deletes), and a row's Delete button with a confirm.{p}_update_manyandelyraUpdateManyanswer{ updated, failed }(RFCs 0084, 0086).
Design
In the table
ondeletemany?: (ids: Key[]) => Promise<{ deleted?: number; failed?: Record<string, string> } | void>
- The button: Delete (danger) in the selection bar, after Set,
when
ondeletemanyis given and something is selected. Adeletable(row)(optional) leaves out rows that can't be deleted, aseditabledoes; they're counted in the question. - Asked once:
confirmwith the count and the list's name ("Delete 340 invoices? This can't be undone." — or, withsoftDeletes, "They can be restored."), danger. - Sent: 500 keys a call, one call at a time; past 20 rows the progress ("Deleting… 500 of 2,340") with Cancel between calls.
- After: the deleted keys leave the selection, and the rows leave a
plain array's view at once (a live page re-runs);
failedkeys stay selected, a toast says how many and the first reason. The announcement says "Deleted 338 invoices. 2 couldn't be deleted." - No undo in the table: a delete isn't a step (RFC 0079's history stays as it was, without the deleted rows' cells).
make:resource
{p}_destroy_many(ctx, ids: Vec<key>) -> Result<{Model}DestroyMany>with the delete ability; each row found (a missing one infailed), then oneDELETE … WHERE id IN (…)(or the soft delete'sUPDATE),{Model}Deleteddispatched for each; answers{ deleted, failed }.- Over a backend:
DELETE {path}with{ ids }; the hint printsRoute::delete('{p}', [Controller::class, 'destroyMany'])and the method withelyraDestroyMany. - The list with
--viewgetsondeletemany(the selection's Delete) where it hasselect; itsbulkkeeps the app's own.
elyraDestroyMany in the package
->elyraDestroyMany($request, ['ability' => 'delete', 'max' => 500]):
ids (at most max), each model through the query and its policy, the
ones that pass deleted in one transaction (each delete(), so soft
deletes, events and observers work), answered { deleted, failed }.
Words
deleteSelected, deleteAsk(count, name), deleteAskSoft(count, name), deleting(done, total), deletingLabel, deletedSome(done, failed), in words.js and en/nb.
Implementation plan
ui: Delete in the selection bar,ondeletemany,deletable, the question, the chunks with progress and Cancel, the selection and rows after, the words.ratatosk:{p}_destroy_many(local and backend),{Model}DestroyMany, the hint, the list'sondeletemany; tests and the smoke.- The Laravel package:
elyraDestroyMany; the test app's route and adeletepolicy;framework/tests/laravel_destroy_many.rsin the Laravel job. - Docs:
table.md,resources.md,backend.md, the skills, CHANGELOG.
Open questions
- Asked once, or typed ("type DELETE")? Recommendation: asked
once, with the count and whether it can be restored. Typing is for
what can't be undone at a scale the app decides; an app can wrap
ondeletemanyin its own question. - The rows a user may not delete: hidden from the count, or
counted? Recommendation: counted in the question ("Delete 338
invoices? 2 can't be deleted.") with
deletable, and the server'sfailedfor the rest. The user sees what will happen before it does. - Undo through restore, for soft deletes? Recommendation: not in
this RFC. A restore command is its own (
{p}_restore_many), and the table's history is for values, not rows.
Decisions
Accepted 2026-11-30, with the open questions' recommendations:
- Asked once, with the count and whether the rows can be restored.
- Rows that can't be deleted are counted in the question
(
deletable), and the server'sfailedsays the rest. - No undo or restore in this RFC.
As built
As designed, with these differences:
- The question doesn't name the list ("Delete 340 rows?"): a table
has a
label, not a plural noun to count with. make:resource's lists don't getondeletemany: they have noselect. The command is there ({p}_destroy_many, local and over a backend); a list the app givesselectpasses it asondeletemany={(ids) => api.x_destroy_many(ids)}.- A key selected that the table has no row for (a live page's
selection, keys never seen) is sent too, and the server's
failedsays what became of it. - Tested against the test app the Laravel CI job builds: a
DELETE /api/customersroute, aCustomerPolicy::deletethat refuses a locked customer and a user withoutcustomers.delete, andframework/tests/laravel_destroy_many.rs, a step of its own in the job.
Not in this RFC
- Restoring soft-deleted rows, and a trash view.
- Deleting with a typed confirmation.
- Deleting rows and their children (cascade is the database's).
Alternatives considered
- Leave it to
bulk. What apps do today: the same snippet, slow over a backend, with no answer for a partial failure. - A loop of
{p}_destroyin the table. No command to write, but a request per row and no transaction.