Skip to content

fix: cap unbounded endpoint picker queries in DashboardController - #233

Merged
morcen merged 1 commit into
mainfrom
claude/loving-curie-0qhuzs
Sep 23, 2026
Merged

morcen merged 1 commit into
mainfrom
claude/loving-curie-0qhuzs

Conversation

@morcen

@morcen morcen commented Sep 22, 2026

Copy link
Copy Markdown
Owner

What was broken

DashboardController::events() and editEvent() both loaded a user's entire endpoint list with no limit, to populate the endpoint picker shown on the Events index and Event edit pages:

'endpoints' => $request->user()->endpoints()->get(['id', 'name', 'url', 'description', 'is_active']),
$endpoints = $request->user()->endpoints()->get();

This is inconsistent with the rest of the controller, which correctly uses paginate(15) for its primary listings. For an account with a large number of endpoints, every visit to /events or /events/{event}/edit serialized the full, unbounded endpoint set into the Inertia response — a scalability gap that gets slower linearly as an account's endpoint count grows.

What changed

Both queries now select only the columns the picker actually uses (id, name, url, description, is_active), order by name, and cap the result with limit(500), matching the suggested fix in the issue.

Tests

Added tests/Feature/DashboardEventsEndpointsPickerLimitTest.php, which seeds 501 endpoints for a user and asserts both the events index page and the editEvent page cap the endpoints prop at 500.

Full suite: 274 passed, 1 skipped (pre-existing skip, unrelated to this change), 0 failures.

Fixes #87

https://claude.ai/code/session_018ZQTyApiuWdFJ4CGMGPgD2


Generated by Claude Code

DashboardController::events() and editEvent() loaded a user's entire
endpoint list with no limit to populate the endpoint picker on the
Events index and Event edit pages. For accounts with a large number
of endpoints, this serialized the full unbounded set into every
Inertia response instead of the paginate(15) used elsewhere in the
same controller.

Cap both queries to the columns the picker actually needs, ordered by
name, with a reasonable limit(500), consistent with the rest of the
controller's pagination conventions.

Fixes #87

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ZQTyApiuWdFJ4CGMGPgD2
@morcen
morcen merged commit d9bb2de into main Sep 23, 2026
2 checks passed
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.

DashboardController::events() and editEvent() load a user's full endpoint list unpaginated

1 participant