nuxt-modules / nuxt-modules/ionic

Plugin & Middleware are out of order

Open
#908 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
457
Forks
53
Avg merge
7h 32m
Merged PRs (30d)
21

Description

🐛 The bug

Currently the issue is visible in the playground, seems that plugins and middleware's are in a race condition.
Not sure how this was not reported. This is pretty major and breaking bug where everything is misfiring. Changes to router behavior are to be expected although even middleware fires twice on landing. If i wasn't blocking UI until I had to add OIDC authentication I guess I wouldn't notice it too.

🛠️ To reproduce

https://stackblitz.com/edit/github-hn98fch1-serjiw7u?file=plugins%2Fhello.ts,middleware%2Fauth.global.ts

🌈 Expected behaviour

Plugins run before middleware, middleware waits for plugin

ℹ️ Additional context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction, especially plugins/hello.ts and middleware/auth.global.ts, and observe their execution order and duplicate middleware run on landing. Trace the Nuxt plugin and middleware lifecycle involved in the reproduction. Done means plugins consistently run before middleware and middleware does not fire twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.