new instance -> TypeError: _dec is not a function
mi4uu opened this issue · comments
mi4uu commented
hi,
I use global store as described in https://mobx.js.org/best/store.html#combining-multiple-stores
so I'm decorating class with @RemoteDev(/{ config }/) like this:
import ProjectsStore from './projects'
import OperatorsStore from './operators'
import StepsStore from './steps'
import remotedev from 'mobx-remotedev'
@remotedev(/*{ config }*/)
export class RootStore {
constructor() {
this.projectsStore = new ProjectsStore(this)
this.operatorsStore = new OperatorsStore(this)
this.stepsStore = new StepsStore(this)
}
}
export default new RootStore()
and creating instance of it that is provided to Provider which lead to error:
TypeError: _dec is not a function
Module../src/store/rootStore.js
src/store/rootStore.js:6
3 | import StepsStore from './steps'
4 | import remotedev from 'mobx-remotedev'
5 | @remotedev(/*{ config }*/)
> 6 | export class RootStore {
7 | constructor() {
8 | this.projectsStore = new ProjectsStore(this)
9 | this.operatorsStore = new OperatorsStore(this)
working application (without remotedev) is here https://github.com/lipt0n/state-POC/tree/master/mobxtest
Björn Zeutzheim commented
I'm getting the same error - using mobx@4
McArthur commented
Hi, I am getting the same error
Deric Cain commented
It looks like you should not invoke the decorator as a function (notice the lack of ()
in @remotedev
):
@remotedev
class SomeStore {}
That at least gets rid of the error for me.