twitter-clone
twitter-clone copied to clipboard
have to refresh routes on both home and status routes
for any data to appear you have to refresh routes on both home and status routes. hydration error.
Hydration completed but contains mismatches.
I'm also having this issue. After login the first time, the main content area is blank until I refresh. Then when clicking on a tweet, the tweet id is undefined so I see a 500 error from prisma. The main content is blank and then when I refresh, it shows the tweet.
If I go back home and click on another tweet, the first tweet shows because it's cached I guess. And even though the id in the url has changed, it still shows undefined if I console.log(route.params.id)
const route = useRoute();
const getIdFromRoute = () => {
console.log(route.params.id); // undefined
};
Same issue if creating a tweet from the home page. When it redirects to status/id the id is undefined until page refresh.
I am using nuxt RC 13 so I've been waiting to run into problems eventually, being 10 releases ahead of what is used in the course.
@isimmons @edwardz8 did you guys find any fixes for the issue, after spending hours I am unable to find any fixes and its disappointing.
here's the repo i created @isimmons that fixed the issue: https://github.com/edwardz8/nuxt3-prisma
i don't remember the exact file(s) that i had to update that fixed the issue as it's been a minute since i've looked at this, but the hydration issue no longer throws the error. good luck :)
Here was my solution
const route = useRouter().currentRoute.value
const id = route.params.id
"useRoute().params.id" is cached for some reason
Here was my solution
const route = useRouter().currentRoute.value
const id = route.params.id
"useRoute().params.id" is cached for some reason
that's quite helpful
Well I tried but it didn't work as expected still thanks for your reply and suggestions.
On Sat, Nov 18, 2023 at 1:11 PM whyAlwaysMe @.***> wrote:
Here was my solution
const route = useRouter().currentRoute.value
const id = route.params.id
"useRoute().params.id" is cached for some reason
that's quite helpful
— Reply to this email directly, view it on GitHub https://github.com/insidewebdev/twitter-clone/issues/4#issuecomment-1817426611, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHE5LVH2PQO3MPOFGXRS37DYFBRCBAVCNFSM57EDI7G2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRG42DENRWGEYQ . You are receiving this because you commented.Message ID: @.***>