Finite-Loop-Club-NMAMIT / flc-website-legacy

Official Repository of Finite Loop Club website.
https://finiteloop.co.in
10 stars 14 forks source link

fix 404 on dynamic routes [profile page] #32

Closed nagarajpandith closed 1 year ago

nagarajpandith commented 1 year ago
NidheeshaT commented 1 year ago

fix this by using getStaticPaths to tell Next.js which and all usernames are available and must be made a valid route and getServerSideProps to fetch user data and return profile data back to main function component

I think that's not why it is showing 404 page, its because of

The loading is already checked here https://github.com/FiniteLoop-NMAMIT/flc-website/blob/c5a62a01d994b7e4069049ccf59af60f52ad4da5/src/components/profile/index.tsx#L237-L240

But you after that you check if data is not there then display 404 page but this happens when loading as data is still yet to come https://github.com/FiniteLoop-NMAMIT/flc-website/blob/c5a62a01d994b7e4069049ccf59af60f52ad4da5/src/components/profile/index.tsx#L263

Please correct me if I'm wrong🤲

nagarajpandith commented 1 year ago

oh, i didn't observe the component being used manually. i assumed it was next.js which was throwing 404. thank you for pointing out🙏🏼 fixed it in 33c2c1c64b1823ac398f2723431b5d5006cebb96