Nuxt.js: middleware redirect page, nuxt loading dont finish

Created on 30 Nov 2018  路  10Comments  路  Source: nuxt/nuxt.js

Version

v2.3.4

Reproduction link

https://nuxtjs.org

Steps to reproduce

When using a custom loading component, router to one pageA, start in nuxt loading components excute, but middleware redirect to pageB( eg: login page )

What is expected ?

pageA: finish in nuxt loding components should excute.

What is actually happening?

pageA: finish in nuxt loding components dont excute.

This bug report is available on Nuxt community (#c8247)
bug-report stale

All 10 comments

Please create a reproduction

custom nuxtLoading component:

<template>
    <div />
</template>

<script>
export default {
    data() {
    },
    methods: {
        start() {
            console.log('nuxt loading start');
        },
        finish() {
            console.log('nuxt loading start');
        }
    }
};
</script>

global middleware:

export default (ctx) => {
    ctx.redirect(pageB)
};

when go to pageA, I find nuxtLoading of pageA start but dont finish

The same thing happens to me, a loop is generated in the middleware

@gongzhibin @MauricioHernanCabrera Please create a CSB for reproduction via https://template.nuxtjs.org/

@manniL I apologize for the inconvenience, it was just a problem with other dependencies of my project

Closing this based on @MauricioHernanCabrera's comment :relaxed:

If the issue persists, please @ me here

@manniL https://codesandbox.io/s/yqrm9rwz89
you click button 'to A and redirect B', and open console, you can find loading start and dont finish

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as 馃晲Pending will not be automatically marked as stale.

export default async ({ store, redirect, app }) => {
  /*global $nuxt*/
  if ($nuxt.$route.path == "/v2/cameras/add" && !store.getters.is_admin) {
    redirect("/v2/cameras")
  }
}

I am having the same issue and it doesn't stop loading

Hey, Nuxt developers, how to fix this bug?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattdharmon picture mattdharmon  路  3Comments

bimohxh picture bimohxh  路  3Comments

surmon-china picture surmon-china  路  3Comments

gary149 picture gary149  路  3Comments

jaredreich picture jaredreich  路  3Comments