Skip to content

[F] Add preview route + submit links#19

Merged
1aurend merged 14 commits into
mainfrom
previews
Jul 2, 2026
Merged

[F] Add preview route + submit links#19
1aurend merged 14 commits into
mainfrom
previews

Conversation

@1aurend

@1aurend 1aurend commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Utilizes draft mode to skip cached entity data and avoid caching admin-only data without duplicating the page tree under a /preview route segment. This PR also updates how auth state is tracked to ensure that both client and server relay environments are in sync and aren't reliant on render-based checks via hooks.

@vercel

vercel Bot commented Apr 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
meru-client Ready Ready Preview, Comment Jul 1, 2026 11:03pm

Request Review

@1aurend

1aurend commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

@dananjohnson I know you're not super familiar with this project, but would you mind 👀 this to see if anything I'm doing here jumps out at you as a problem? I couldn't use the standard next-auth hooks to sync session across client and server for a couple of reasons:

  1. The two relay environments— waiting a render for the useSession hook to find the token and supply it to the client relay env for client-side refetches was causing relay to error with null fragments.
  2. Because we're caching, but also allowing to users to effectively "view drafts" at the same URL and not in a container like an iframe in the CMS, we needed a way to ensure that both viewer data and entity data that requires auth is never cached.

Custom setup to satisfy four constraints on the auth setup:
1. ISR caching stays for the public/anonymous view.
2. Viewer data must never be cached — it's per-user.
3. Draft (auth-required) entity data must never be cached, and it's
   served at the same URL as the public page (no iframe/CMS container).
4. The client Relay env needs the token without a render-delay race —
   lazily supplying it via useSession produced null fragments and Relay
   errors
@1aurend
1aurend merged commit 5c0f78c into main Jul 2, 2026
4 checks passed
@1aurend
1aurend deleted the previews branch July 2, 2026 17:23
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.

1 participant