bridge icon indicating copy to clipboard operation
bridge copied to clipboard

From parameter in Middleware is always undefined

Open Jesus82 opened this issue 2 years ago • 3 comments

Environment

Build Modules: nuxt/[email protected]

Reproduction

https://stackblitz.com/edit/github-dwx287-ydqqtk?file=package.json

Describe the bug

Related to https://github.com/nuxt/bridge/issues/942, now Middleware is working, but from parameter always appear undefined.

Additional context

No response

Logs

No response

Jesus82 avatar Nov 02 '23 12:11 Jesus82

It seems that in Nuxt 2, from is undefined if reloaded. https://stackblitz.com/edit/github-dwx287-bmmrvv

I don't know if it can be made to work the same as Nuxt 3, but I will investigate.

wattanx avatar Nov 02 '23 13:11 wattanx

On the initial visit, from becomes undefined. (same behavior for router middleware) The from is present when client navigation is used. (For example, when transitioning from index to next-page, from is defined.)

It behaves differently from nuxt 3, but I don't think it will hinder the transition, so I'll put a workaround available label on it.

wattanx avatar Nov 04 '23 03:11 wattanx

@wattanx thanks for the insight.

Just to add to this, I'm using it for redirects, so even if it is possible to test it like that for other functionalities, for this it is difficult to make it work if first load is undefined.

Jesus82 avatar Nov 08 '23 15:11 Jesus82