Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
Get object value instead of observer type in Vuex module

I'm trying to get the value from the Vuex module state inside the mutation. But I'm always getting the Observer object instead of a real object.

@Module({
    namespaced: true,
    name: 'myModule',
    dynamic: true,
    store
})

export class MyModule extends VuexModule {
    public users: ArrayToObjMap<Users> = {};

    @Action
    public async initialize() {
      const fetchedUsers = await UsersService.getUsers();
      this.context.commit('setUsers', fetchedUsers);
    }

    @Mutation
    public setUsers(usersList: string[]) {
      this.users = GlobalUtils.mapIdsToItems(usersList, this.users)[0];
    }
}

Inside setUsers Mutation, the value of this.users is always Observer. I need to get the simple object to iterate through. I've already tried several solutions:

  1. JSON.parse(JSON.strinfigy(this.users)); => returns empty object
  2. cloneDeep(this.users); => returns empty object
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!