Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| updatedAt: { $gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) }, | ||
| }) | ||
| .sort({ createdAt: -1 }) | ||
| .toArray(), |
| const [retrying, setRetrying] = useState<string | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| const fetchDashboard = async () => { |
There was a problem hiding this comment.
fetchDashboard is duplicated. The useEffect one should reference the normal one or use useCallback, not define its own copy.
| }, [statusFilter, typeFilter]); | ||
|
|
||
| useEffect(() => { | ||
| fetchJobs(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
https://github.com/gholtzap/Mailman/pull/9/changes#r2899998450
(except u dont need to keep the polling via setInterval on this one)
|
bro claude wouldn't listen to me wtf |
|
time to trad code |

No description provided.