nuxt/nuxt

avoid redirect loops

Ouverte

#13 565 ouverte le 28 mars 2022

 (7 commentaires) (7 réactions) (0 personne assignée)TypeScript (5 607 forks)batch import
good first issue🍰 p2-nice-to-have

Métriques du dépôt

Stars
 (60 221 étoiles)
Métriques de merge PR
 (Merge moyen 3j 7h) (114 PRs mergées en 30 j)

Description

Reference: https://github.com/nuxt/framework/pull/3908#issuecomment-1079665687

With redirectTo, it is possible to make a loop condition return navigateTo(to.path).

A simple fix would be check and avoid redirect to exact same URL.

In more complex cases, a redirect loop can be nested like a~>b~>a which we could implement with help of a persisted state. (we can wait for this until having session support and benefit from session to hold such state)

Guide contributeur