Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tema escuro no SSR #288

Open
iquabius opened this issue Feb 28, 2020 · 0 comments
Open

Tema escuro no SSR #288

iquabius opened this issue Feb 28, 2020 · 0 comments

Comments

@iquabius
Copy link
Owner

iquabius commented Feb 28, 2020

O tema claro/escuro só é buscado do cookie no frontend. Quando o tema é escuro o SSR renderiza o tema claro e só depois da primeira renderização no navegador que ele troca p/ escuro.

Isso acontece porque o useEffect() em ThemeContext não é executado no SSR.

Para resolver isso precisamos transformar o ThemeProvider numa classe e usar o constructor, como era feito em _app.tsx antes de #287. Ou voltar a lógica toda p/ _app.tsx.

gatsbyjs/gatsby#13947

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant