fix: cap unbounded endpoint picker queries in DashboardController - #233
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
DashboardController::events()andeditEvent()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: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/eventsor/events/{event}/editserialized 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 byname, and cap the result withlimit(500), matching the suggested fix in the issue.Tests
Added
tests/Feature/DashboardEventsEndpointsPickerLimitTest.php, which seeds 501 endpoints for a user and asserts both theeventsindex page and theeditEventpage cap theendpointsprop 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