Component's property is not updated when using vuex-module-decorators

306 Views Asked by At

I am using VueJs 2.6 with TypeScript support and vuex-module-decorators to manage application state.

Here is one of my components:

const MyModule = namespace(`MyModule`);

... component definition ...

@MyModule.State('prop1')
public prop1!: SomeModel;

that is wired to a state module:

@Module({ namespaced: true })
export class MyModule extends VuexModule {
  public prop1!: SomeModel | null;
...
}

When a mutation in MyModule sets property prop1, the corresponding property in the component does not get updated. I checked, mutation is called correctly and state's property is updated.

How to make my component's properties update automatically after state gets changed?

1

There are 1 best solutions below

0
On

i found it it was the Examination the suffix you added to be not null "!" if you remove it it will be updated. i do not why exactly it is working like this.