facebook / facebook/docusaurus

onRouteDidUpdate does not see new Head metadata

Abierto
#8,278 0 comentarios 1 reacción 0 asignados Ver en GitHub
bug
Lenguaje dominante
TypeScript
Estrellas
66.2k
Forks
10k
Merge medio
1 d 3 h
PR fusionados (30 d)
52

Descripción

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).

### Prerequisites

- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).

### Description

When navigating between routes, the `onRouteDidUpdate` client module lifecycle does not see the newly updated Head / Helmet metadata

This leads to annoying usage of setTimeout in userland plugins.

As commented in https://github.com/facebook/docusaurus/issues/3399#issuecomment-1300174763, I believe this is due to `react-helmet-async` using `` by default (to confirm).

We should study the impact of turning `defer={false}`: performance or anything else

### Reproducible demo

_No response_

### Steps to reproduce

Take a deploy preview, navigate to another page, and look at console logs.
https://deploy-preview-8275--docusaurus-2.netlify.app/

![CleanShot 2022-11-02 at 12 41 44@2x](https://user-images.githubusercontent.com/749374/199481590-91461e33-78a8-4999-8b67-809429a66929.png)

### Expected behavior

title/description (and other metadata) should rather be correct

### Actual behavior

title/description is incorrect

### Your environment

_No response_

### Self-service

- [X] I'd be willing to fix this bug myself.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.