Roland
TTCTheo's Typesafe Cult
•Created by Roland on 1/31/2025 in #questions
Prevent router.refresh() from remounting client components
I have the following logic:
1) Fetch data in SSR layout, pass to Client Component
2) In Client Component,
useEffect(() => { ... }, []);
with empty dependencies for rendering only once upon component mount. This effect checks if the passed data from the layout is valid, if it isn't, make an API request with client-side infos (need to set cookies, save ip and guest session in database). If the API request succeeds, get valid data from SSR layout with router.refresh()
.
=> Expected behaviour: The useEffect only runs once.
=> Actual behaviour: The useEffect runs twice, because router.refresh() apparently completely remounts the client component. This leads to inconsistent data in my guest sessions.
Any suggestions? :)10 replies
TTCTheo's Typesafe Cult
•Created by Roland on 1/10/2025 in #questions
t3chat development
How many cumulative dev hours did this take to develop?
7 replies
TTCTheo's Typesafe Cult
•Created by Roland on 12/11/2024 in #questions
UploadThing: Image upload successful, but reaching neither onUploadError nor onUploadSuccess
This used to work for some time, but today it stopped working
5 replies