Skip to content

fix(spa): render every ModelAdmin.actions entry on detail page (#618, #619) + release 1.4.11#621

Merged
MartinCastroAlvarez merged 1 commit into
mainfrom
chore/release-v1.4.11
May 29, 2026
Merged

fix(spa): render every ModelAdmin.actions entry on detail page (#618, #619) + release 1.4.11#621
MartinCastroAlvarez merged 1 commit into
mainfrom
chore/release-v1.4.11

Conversation

@MartinCastroAlvarez
Copy link
Copy Markdown
Owner

Closes #618, closes #619.

#618 — drop the over-narrow detail-page filter

The 1.4.9 object_actions.filter(target === 'detail') filter dropped every batch-classified action on the floor. Since the stock Django pattern is @admin.action(description=...) with (modeladmin, request, queryset) — i.e. target: 'batch' — virtually every consumer's actions were invisible on the detail page. That contradicted the documented "one @admin.action → two surfaces" contract.

Fix: render every entry in object_actions. The action runner endpoint already dispatches both shapes correctly — batch as action(modeladmin, request, queryset_of_one) against the detail page's single pk, detail as action(modeladmin, request, str(pk)). Both work; the filter was the bug.

- {(data.object_actions ?? [])
-   .filter((action) => action.target === 'detail')
-   .map(...)}
+ {(data.object_actions ?? []).map(...)}

#619 — README copy matches the corrected behaviour

Rewrote the "Add custom admin actions" section. The default example is now the stock (modeladmin, request, queryset) shape (it now correctly renders on both surfaces); the detail-only signature is documented as the optional second path. The previous copy implied an exclusive split (batch → changelist-only) — that mental model is what produced #618.

Verification

  • pnpm -r typecheck
  • pnpm lint (js + css + darkmode coverage) ✓
  • pnpm test — 163 / 163 ✓
  • pnpm -w build

Not in this PR

🤖 Generated with Claude Code

The 1.4.9 detail-page filter `object_actions.filter(target === 'detail')`
dropped every batch-classified action on the floor — and since the
stock Django pattern is `@admin.action(description=...)` with the
`(modeladmin, request, queryset)` signature, virtually every
consumer's actions were tagged `batch` and invisible on the detail
page. That contradicted the documented "one declaration → two
surfaces" contract.

Drop the filter. The action runner endpoint already dispatches both
shapes correctly — batch is invoked as
`action(modeladmin, request, queryset_of_one)` against the detail
page's single pk; detail-shaped actions stay called as
`action(modeladmin, request, str(pk))`. Both work on the detail page.

Also (#619): rewrite the README "Add custom admin actions" section
so the default shape (queryset) is the example, and detail-only
shape is the optional second path. The previous copy implied an
exclusive split where batch was changelist-only — that was the
mental model that produced this bug.

Closes #618, closes #619.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MartinCastroAlvarez MartinCastroAlvarez merged commit 4392835 into main May 29, 2026
5 checks passed
@MartinCastroAlvarez MartinCastroAlvarez deleted the chore/release-v1.4.11 branch May 29, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants