Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Nuxt middleware & page setup does not execute in the expected order when refreshing page

Đang mở
#564 5 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
nuxtjs, typescript
Lĩnh vực
frontend, mobile

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết và so sánh các cấu hình Nuxt-only, Ionic, i18n và Ionic-plus-i18n. Kiểm tra thiết lập tích hợp router trong nuxt.config được đề cập trong issue và tái hiện hành vi khi refresh. Được xem là hoàn tất khi setup kết hợp duy trì đúng thứ tự mong đợi: middleware toàn cục, middleware của trang, app setup, sau đó là page setup.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
🐛 The bug

I was using middleware to fetch user configuration data before navigating to pages, when I realized that the page setup was run before the middleware. Through some trial and error I figured out that removing Nuxt/ionic fixed the issue, but I also found out that adding the Nuxtjs/i18n module worsened the issue.

So I created a project tracking the following:

  • Global middleware
  • Page middleware
  • App setup function
  • Page setup function

And I got these results:

  • (Nuxt alone) works as expected:
    image
  • (Nuxt + Nuxt/ionic) App setup gets run first but everything else in the correct order:
    image
  • (Nuxt + Nuxtjs/i18n) works as expected:
    image
  • (Nuxt + Nuxt/ionic + Nuxtjs/i18n) every page setup is run before middleware
    image

I'm still pretty new to Nuxt & Ionic so I might be completely missing some critical information, but the Nuxt/ionic documentation gives the impression that middleware should just work with no caveats.

🛠️ To reproduce

https://stackblitz.com/edit/hui123

🌈 Expected behaviour

For the execution order to match the basic Nuxt project when refreshing the page, and to also work with the i18n nuxt module

  1. Global middleware
  2. Page middleware
  3. App setup function
  4. Page setup function
ℹ️ Additional context

Reproductions used to get the different results:
Nuxt middleware order (Nuxt only)
Nuxt middleware order (Ionic)
Nuxt middleware order (i18n)
Nuxt middleware order (Ionic + i18n)

It might be related to the ionic router integration, because if I disable it in nuxt.config the execution order goes back to normal.

Ngôn ngữ chính
TypeScript
Star
458
Fork
54
Merge trung bình
16 giờ 28 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nuxt-modules/ionic

Tất cả issue của nuxt-modules/ionic

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.