Skip to content

Server Side Rendering#9

Open
jasonzh0 wants to merge 5 commits into
mainfrom
jason/ssr
Open

Server Side Rendering#9
jasonzh0 wants to merge 5 commits into
mainfrom
jason/ssr

Conversation

@jasonzh0
Copy link
Copy Markdown
Collaborator

@jasonzh0 jasonzh0 commented Mar 6, 2026

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 6, 2026

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

Project Deployment Actions Updated (UTC)
mailman Ready Ready Preview, Comment Mar 7, 2026 3:46pm

Request Review

@jasonzh0 jasonzh0 marked this pull request as ready for review March 6, 2026 05:28
@jasonzh0 jasonzh0 requested a review from gholtzap as a code owner March 6, 2026 05:28
@gholtzap
Copy link
Copy Markdown
Owner

gholtzap commented Mar 6, 2026

all newly registered users get a 404 on every page

getUserForPage calls notFound() when no user document exists. But the dashboard and settings API routes have auto-creation logic (insert a new user if missing). A brand new Clerk user hitting any SSR page will get a 404 instead of being onboarded

on get-user-for-page.ts, The !user case should auto-create the user (like the dashboard API route does), or at minimum redirect to a page that does

Screenshot 2026-03-06 at 12 59 16 AM

Comment thread apps/web/app/(auth)/jobs/JobsClient.tsx
Comment thread apps/web/app/(auth)/dashboard/page.tsx
Comment thread apps/web/app/api/schedules/route.ts Outdated
Comment thread apps/web/lib/data/dashboard.ts Outdated
updatedAt: { $gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) },
})
.sort({ createdAt: -1 })
.toArray(),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

add a .limit(50) or similar

const [retrying, setRetrying] = useState<string | null>(null);

useEffect(() => {
const fetchDashboard = async () => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

fetchDashboard is duplicated. The useEffect one should reference the normal one or use useCallback, not define its own copy.

}, [statusFilter, typeFilter]);

useEffect(() => {
fetchJobs();
Copy link
Copy Markdown
Owner

@gholtzap gholtzap Mar 7, 2026

Choose a reason for hiding this comment

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

This fires a client-side api request which replaces the ssr's initialData right away, kinda defeating the purpose of ssr

The initial call should be skipped; only the polling interval is needed

skip only the first invocation while keeping the filter-change behavior. Make sure to keep the polling via setInterval for this specific instance

A common pattern:

const isFirstRender = useRef(true);

useEffect(() => {
    if (isFirstRender.current) {
        isFirstRender.current = false;
        return;
    }
    fetchPapers();
}, [fetchPapers]);

This preserves the SSR initial data on first render, but re-fetches whenever a filter changes

}, []);

useEffect(() => {
fetchPapers();
Copy link
Copy Markdown
Owner

@gholtzap gholtzap Mar 7, 2026

Choose a reason for hiding this comment

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

https://github.com/gholtzap/Mailman/pull/9/changes#r2899998450

(except u dont need to keep the polling via setInterval on this one)

@jasonzh0
Copy link
Copy Markdown
Collaborator Author

jasonzh0 commented Mar 8, 2026

bro claude wouldn't listen to me wtf

@jasonzh0
Copy link
Copy Markdown
Collaborator Author

jasonzh0 commented Mar 8, 2026

time to trad code

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.

2 participants