Fix events search/filter silently missing results beyond the first page - #227
Merged
Merged
Conversation
Events/Index.vue filtered the search box and type dropdown purely client-side over props.events.data, which is only the current paginated page (15 records). Any account with more than one page of events would see "No events found" for a search term or type that existed on another page, even though a real match existed. DashboardController::events() now applies the search/type filters server-side before paginating, and returns the full list of distinct event types (not just the ones on the current page) so the type dropdown is complete. The Vue page submits filters as query params via Inertia's router.get, mirroring the pattern already used on the Deliveries page. Fixes #97 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012RH3zCxQdDbtSWbnGrvDaC
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
The Events management page's search box and type filter (
resources/js/Pages/Events/Index.vue) filtered purely client-side overprops.events.data, which is only the current paginated page (15 records) returned byDashboardController::events(). For any account with more than one page of events, searching for (or filtering by type of) an event that existed on another page silently showed the "No events found" empty state, even though a real match existed. The type dropdown had the same problem: it only listedevent_typevalues present on the currently loaded page, so types that only occurred on other pages never appeared as filter options at all.This is worse than not having search/filtering, since it looks like it works but silently returns incomplete/wrong results.
What changed
DashboardController::events()now applies thesearchandtypequery params as server-sideWHEREconditions before paginating, so filtering runs over the full result set instead of just the loaded page.eventTypes, a distinct list of event types across all of the user's events (not just the current page), so the type dropdown is complete.Events/Index.vuesubmitssearch/typeas query params via Inertia'srouter.get(on Enter for the search box, on change for the type select), mirroring the pattern already used on the Deliveries page'sapplyFilters(). The old client-side-only filtering computed properties were removed since filtering now happens server-side.Tests
Added
tests/Feature/DashboardEventsSearchFilterTest.php, covering:eventTypesprop lists types across all of a user's events, not just the current page.Full suite:
composer test— 260 passed, 1 skipped.Fixes #97
🤖 Generated with Claude Code
https://claude.ai/code/session_012RH3zCxQdDbtSWbnGrvDaC