[Vuejs]-Vue Array shuffling 2 time(in ssr and browser)

0👍

Weird behavior with the variable data

With help from This question’s answer. I tried getting data in async Fetch() method so it can work on Both SSR and browser.

async fetch() {
    var designCategory = await this.$store.getters["design/category"];
    var result = designCategory.find((i) => i.url === this.category);
    this.catMetal = result.metal;
    var newRelatedArray = designCategory.filter(
      (i) => i.metal === result.metal 
    );

    this.myCategory = this.shuffle(newRelatedArray);
  },

And it worked.

Leave a comment