Skip to content

Add Refresh button to feed#2

Open
cosmo-coderbots[bot] wants to merge 1 commit into
mainfrom
feat/refresh-button
Open

Add Refresh button to feed#2
cosmo-coderbots[bot] wants to merge 1 commit into
mainfrom
feat/refresh-button

Conversation

@cosmo-coderbots

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Refresh button between the composer and the post feed
  • Clicking it fetches new posts from the server without a full page reload, preserving scroll position and client state
  • Uses refresh() from next/cache via a Server Action — the correct Next.js 16 approach (client-side router.refresh() was being blocked by cross-origin dev resource protection when tunnelled through Cloudflare)
  • Adds *.trycloudflare.com to allowedDevOrigins in next.config.ts so HMR and RSC requests aren't blocked in dev

Test plan

  • Start dev server and open the app
  • Post or insert a new record directly in the DB
  • Click Refresh — new post should appear at the top without a page reload
  • Confirm the button shows "Refreshing…" while in flight and re-enables after
  • Confirm existing composer state (typed text, image preview) is preserved across a refresh

🤖 Generated with Claude Code

Adds a Refresh button between the composer and the feed that pulls
new posts from the server without a full page reload.

Uses a Server Action calling refresh() from next/cache (the Next.js 16
idiomatic approach) rather than client-side router.refresh(), which was
being blocked by the cross-origin dev resource protection when accessed
through a Cloudflare tunnel. Also adds *.trycloudflare.com to
allowedDevOrigins so HMR and RSC requests aren't blocked in dev.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cosmo-coderbots

Copy link
Copy Markdown
Contributor Author

Automated visual review

Verdict: ✅ Verified

What I checked: Clicked the Refresh button after inserting a new post directly into the DB, with draft text already typed in the composer.

Observed:

  • Refresh button is rendered between the composer and feed ✓
  • New post ("Brand new post to test the refresh! 🎉") appeared at the top of the feed without a full page reload ✓
  • Composer text ("Testing composer state preservation during refresh...") was fully preserved after refresh ✓
  • Button re-enabled after the refresh completed ✓

Steps taken:

  1. Opened app at http://localhost:3200, confirmed Refresh button visible
  2. Typed draft text into the composer
  3. Inserted a new post directly into Postgres via psql
  4. Clicked Refresh — new post appeared at top; composer text intact

Before (initial load):

before

After (post-refresh):

after


Reviewed from commit 8314c2921d7b22210880f8e7721717f9103e257a on branch pr-2. Screenshots hosted on claude-reviews/pr-2.

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.

0 participants