curaOS / source

Start a solid foundation of tools for creators+builders.
https://cura.run
15 stars 13 forks source link

Randomized homepage project #152

Closed sekaiking closed 2 years ago

sekaiking commented 2 years ago

The reason I randomized the project page inside useEffect instead of doing it directly in useState is that Image Component doesn't update correctly, not sure why it happens but my guess it's something to do with NextJs cache. useEffect makes sure to change the page only after the component is settled.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/curaos/frontend/VHTKzws13s2Vy2Z8ux1wLUXx15Dr
✅ Preview: https://frontend-git-randomhome-curaos.vercel.app

bestatigen commented 2 years ago

Component doesn't update correctly, not sure why it happens but my guess it's something to do with NextJs cache

@achrafismyname Could you look into what's happening? Cause locally it works fine, it's just when it's deployed on Vercel that gives problems. The version you pushed is not optimal as it at always shows the first slide before jumping to the random one.

sekaiking commented 2 years ago

Ok, I'll look more into that

sekaiking commented 2 years ago

https://github.com/vercel/next.js/issues/10608

The only solution is to use useEffect or disable SSR

sekaiking commented 2 years ago

Instead of showing the first slide, i'll put a loading animation. Hopefully this makes it look better

sekaiking commented 2 years ago

I removed the slide, until we random the first project slide.

I don't know if SEO matters in this project, but the projects in this page can't be crawled because they are all browser rendered. Before we had 1 project that can be seen by crawling bots, after this change zero can be seen.

bestatigen commented 2 years ago

As said in that issue linked:

Generally I'd just recommend not randomly shuffling stuff in the UI

I think there could have been a better solution here in general, but it's a minor adjustment and the homepage will probably have more iteration in the future. Let's merge it! 😄