Skip to content

feat(events): add time range filter to events page - #214

Merged
MathurAditya724 merged 2 commits into
mainfrom
issue-200-events-time-filter
Sep 19, 2026
Merged

MathurAditya724 merged 2 commits into
mainfrom
issue-200-events-time-filter

Conversation

@jared-outpost

@jared-outpost jared-outpost Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

adds a time-range dropdown to the events filter bar with presets (last hour, 6 hours, 24 hours, 7 days, all time), placed after the repo search and synced to the url via ?timeRange=. the backend GET /api/events now accepts from/to unix-second query params and filters webhook_events.created_at server-side.

the selected range is stored as a stable token (e.g. 24h) in the url; the from boundary is recomputed relative to now on each render so "last hour" stays accurate without polluting the url. "all time" clears the param.

Testing

  • pnpm --filter @jared/server run test events-time-filter (4 tests, pass)
  • pnpm tsc --noEmit (apps/server, clean)
  • pnpm biome check on changed files (clean)

Closes #200

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 19, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
jared 1bd8478 Sep 19 2026, 06:46 PM

@jared-outpost
jared-outpost Bot marked this pull request as ready for review September 19, 2026 15:12
@jared-outpost

jared-outpost Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

CI green (lint/typecheck/test/build). self-review clean. ready for review.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7989d32. Configure here.

Comment thread apps/server/src/client/pages/events.tsx Outdated
Comment thread apps/server/src/client/pages/events.tsx Outdated
@jared-outpost

jared-outpost Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

re: cursor bugbot review #pullrequestreview-5256153084 — the one issue it flagged (time window freezing on auto-refetch) is fixed in 5a1daa7 and answered on the inline thread. no other issues outstanding.

@jared-outpost

jared-outpost Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

thanks bugbot — the one issue (stale/expanding time window from the memoized `from`) is fixed in 5a1daa7. `from` is now derived at fetch time inside the `useEvents` queryFn from a relative `windowSeconds`, so auto-refetches keep a sliding window. detail in the inline thread replies.

@MathurAditya724
MathurAditya724 enabled auto-merge (squash) September 19, 2026 18:43
Adds a time-range Select to the events filter bar with presets (last hour,
6 hours, 24 hours, 7 days, all time), synced to the URL via ?timeRange=.
The backend GET /api/events now accepts from/to unix-second query params
and filters webhook_events.created_at accordingly.

Fixes #200
The from cutoff was memoized on timeRange and baked into a stable react-query
key, so the 10s auto-refetch kept reusing the timestamp captured at selection
time and a 'last hour' window silently widened while the page stayed open.
Pass the window size instead and derive from at fetch time inside the query
function, keeping the cache key stable while each refetch gets a current cutoff.
@MathurAditya724
MathurAditya724 force-pushed the issue-200-events-time-filter branch from 5a1daa7 to 1bd8478 Compare September 19, 2026 18:46
@MathurAditya724
MathurAditya724 merged commit 5de5db0 into main Sep 19, 2026
12 of 14 checks passed
@MathurAditya724
MathurAditya724 deleted the issue-200-events-time-filter branch September 19, 2026 18:46
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.

Add date/time range filter to events page

1 participant