VitorLuizC/vue-loadable

Should this work between components?

DanHulton opened this issue · 4 comments

I have two components, both of which have the following code:

<template>
    <div v-if="$isLoading('updatePurchase')">
      Updating...
    </div>
</template>

<script>
...
  methods: {
    ...mapLoadableMethods(
      mapActions('Licenses', [
        'updatePurchase',
      ]),
    ),
  },
...
</script>

If I call this.updatePurchase() from component A, "Updating..." appears on component A, but not component B. If I call this.updatePurchase() from component B, "Updating..." appears on component B, but not component A.

Is this intended behaviour that I have to work around for sharing loading state between multiple components, or have I set something up incorrectly?

Your code is correct, today vue-loadable don't share its loading state between multiple components. But would be a pretty nice improvement.

Okay, thanks! I might take a look at this, if you're open to PRs. I'll throw it on the backlog.

I'm open to PRs, but I can work on it this week.

Only if it's something you're really interested in! It'd be a very useful feature, but there are definitely workarounds in the meantime.