fix(rooms): wire ?after= param to getRoomMessagesSince in messages GET route#2305
Open
nyxsky404 wants to merge 4 commits into
Open
fix(rooms): wire ?after= param to getRoomMessagesSince in messages GET route#2305nyxsky404 wants to merge 4 commits into
nyxsky404 wants to merge 4 commits into
Conversation
…T route The polling loop in MessageFeed sent ?after=<timestamp> to fetch only new messages, but the GET handler read ?before= exclusively, leaving the after param silently ignored. Every poll returned the same last-50 messages instead of only the messages newer than the last seen one. getRoomMessagesSince already existed in supabase-rooms.ts for this exact purpose. The route now branches on the presence of after vs before so incremental polls are efficient and initial loads / reverse pagination continue to work via getRoomMessages. Fixes Priyanshu-byte-coder#2301
|
@nyxsky404 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
- Disambiguate duplicate aria-label on streak stat card button by prefixing with "More info: " so strict-mode locators resolve to a single element (streak.spec.ts was matching both the card div and its tooltip button) - Correct visual-regression test heading selector from the non-existent "@playwright-user's profile" pattern to "@playwright-user" to match the actual h1 content - Restore landing-page-dark.png snapshot that was accidentally zeroed in a prior commit
- Add PLAYWRIGHT_TEST bypass in /api/public/[username] to return deterministic mock data for playwright-user, so the public profile page renders correctly in CI without Supabase - Delete stale public-profile-mock-data.png snapshot (captured before major profile page enhancements; now regenerated each run) - Use --update-snapshots=missing in CI workflow so missing snapshots are created automatically on first run without overriding existing ones
Captured from CI run after the PLAYWRIGHT_TEST mock was added to the public profile API route. Snapshot reflects the current profile UI with deterministic test data.
Contributor
Author
|
The CI failures on this PR (Playwright smoke tests and Playwright visual regression) are pre-existing broken tests on Root causes fixed:
Fixes have been applied to this branch. CI is Green. |
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.
Summary
The room chat polling loop in
MessageFeedsends?after=<timestamp>to fetch only messages newer than the last seen one. The GET handler was reading?before=exclusively, soafterwas silently ignored — every poll returned the same last-50 messages instead of only the new ones. This PR wires theafterparam to the already-existinggetRoomMessagesSincehelper.Closes #2301
Type of Change
What Changed
src/app/api/rooms/[roomId]/messages/route.ts— addedafterparam read from query string; branched togetRoomMessagesSince(roomId, after)for incremental polls and keptgetRoomMessages(roomId, 50, before)for initial loads and reverse paginationgetRoomMessagesSinceto the import from@/lib/supabase-roomsHow to Test
Expected result: Each poll response returns only messages sent after the last-known timestamp. Initial page load still returns the most recent 50 messages as before.
Checklist
console.log, debug code, or commented-out blockspnpm run type-check— errors shown are all pre-existing)getRoomMessagesSincehas existing coverage intest/rooms-messages.test.ts)