[Vuejs]-Vuex state changing with mutation – apollo graphql query

0👍

Although I still don’t quite understand why, it seems like the changes to the apollo variable story affect the store.story values with using the mutations to set them.

I’ve modified the initial setters to be like this:

          this.setText(data.story.description)
          let loadedStory = {
            name: data.story.name,
            description: data.story.description,
            summary: data.story.summary,
          }
          this.setStory(loadedStory)
          this.setEditedStory(data.story)
        },

which seems to prevent the state.story from following the changes to the apollo created story variable. This seems like unexpected behaviour, and I don’t quite understand what part of javascript object assignment makes this work this way.

Leave a comment