twitter-clone icon indicating copy to clipboard operation
twitter-clone copied to clipboard

have to refresh routes on both home and status routes

Open edwardz8 opened this issue 2 years ago • 6 comments

for any data to appear you have to refresh routes on both home and status routes. hydration error.

Hydration completed but contains mismatches.

edwardz8 avatar Aug 21 '22 01:08 edwardz8

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 avatar Nov 16 '22 09:11 isimmons

@isimmons @edwardz8 did you guys find any fixes for the issue, after spending hours I am unable to find any fixes and its disappointing.

ghost avatar Sep 02 '23 22:09 ghost

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 :)

edwardz8 avatar Sep 05 '23 17:09 edwardz8

Here was my solution

const route = useRouter().currentRoute.value

const id = route.params.id

"useRoute().params.id" is cached for some reason

ivan119 avatar Oct 30 '23 20:10 ivan119

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

Hi99s avatar Nov 18 '23 07:11 Hi99s

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: @.***>

ghost avatar Nov 19 '23 06:11 ghost