progress icon indicating copy to clipboard operation
progress copied to clipboard

Progress Indicator not showing on $inertia.reload()

Open zacksmash opened this issue 4 years ago • 5 comments

Versions:

  • @inertiajs/inertia version:0.9.4
  • @inertiajs/inertia-vue3 version: 0.4.7

Describe the problem:

I'm using $inertia.reload() in my mounted hook to fetch data that takes a bit longer to retrieve (3rd party API). However, doing this no longer shows the progress indicators, via InertiaProgress.

Steps to reproduce:

  1. Navigate to a page, with standard injected props.
  2. In your components mounted() lifecycle hook, make another request using the only option.
this.$inertia.reload({
      only: ['someApiData', 'someMoreApiData',],
})

zacksmash avatar Jul 14 '21 17:07 zacksmash

@zacksmash I think i am runnig similar issue. Did you solve it?

https://github.com/inertiajs/inertia/discussions/965#discussioncomment-1645387

robsontenorio avatar Nov 15 '21 16:11 robsontenorio

@robsontenorio I haven't yet, I ended up throwing a custom loading indicator for my reload() request, but it would be nice if Inertia could use the built in NProgress during that.

zacksmash avatar Nov 15 '21 16:11 zacksmash

@zacksmash I have tried custom loading, but no luck. Could you answer my comment with your solution?

https://github.com/inertiajs/inertia/discussions/965#discussioncomment-1645387

robsontenorio avatar Nov 15 '21 16:11 robsontenorio

@robsontenorio Sure, my doesn't look too different from your solution, in your comment, but here's what I have

data() {
    loading: true,
},
...
mounted() {
    this.$inertia.reload({
      only: ['someData'],
      onSuccess: () => this.loading = false
    })
  }

zacksmash avatar Nov 15 '21 17:11 zacksmash

@zacksmash Are you able to get that loading working when navigating to that target page using both approaches?

From any orgin page, in my case:

It works with <a href="/somepage"> go </a> But not woks with this.$inertia.visit('/somepage')

EDIT:

  • Main problem here is onStart.
  • Just noticed we are using reversed logic for loading, so in your case won't be an issue.

robsontenorio avatar Nov 15 '21 17:11 robsontenorio