Next.js Discord

Discord Forum

Components are blank in index page but work fine in other pages

Unanswered
Atlantic herring posted this in #help-forum
Open in Discord
Atlantic herringOP
@ me if u need more info
im fetching data with use effect and they work fine in other pages
but theyre blank on the index page
and they i imported them

36 Replies

Atlantic herringOP
i just realised that the problem is not only in the index page, some pages work fine, some dont,the components that are missing data are called in the app.js file
Atlantic herringOP
i think it has to do with something about translation
bc even my translated variables in common.js are not being translated
Atlantic herringOP
as u can see in some pages the navbar is showing in others no(data fetched inside)
Atlantic herringOP
this is the file structure
ik its irrelevant for this but jic
Asiatic Lion
try deleting .next and try again. if that doesn't work we'll probably need to see your navbar and index.js code
Atlantic herringOP
if i delete the .next will it create a new one instantly?
@Asiatic Lion
with npm build?
Asiatic Lion
yeah
Atlantic herringOP
ye didnt work
they are being shown on this page
not on this
not a caching issue
working here
@Asiatic Lion u gave up? 😆
cz me personally i did
cz i have no idea whats happening
Asiatic Lion
yeah. no idea how that doesn't work... do you get anything in the javascript console on the pages that don't show the navbar properly?
Atlantic herringOP
wait
client.js:1 Invalid href 'en//' passed to next/router in page: '/OurOffers'. Repeated forward-slashes (//) or backslashes \ are not valid in the href.
nah thats not what the problem is
Asiatic Lion
there is also a 404
Atlantic herringOP
thats because the translation is not working
it cant find the image path from the common.js locale file
i have to clean up these errors sheesh
Atlantic herringOP
@Asiatic Lion
import Hero from '@/components/Hero'
import Clients from '@/components/Clients'
import Solutions from '@/components/Solutions'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';


export default function Home({ pages }) {
return (
#Unknown Channel
<Hero />
<Solutions />
<Clients />
</>
)
}

export const getServerSideProps = async ({ locale }) => ({
props: {
...(await serverSideTranslations(locale, ['common']))
}
});
fixed