Create store ReferenceError when Store Class only has constructor
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 312
- PR merge metrics
- No merged PRs in 30d
Description
I have a simple store ...
``` js
import alt from 'altInstance';
import ActivityActions from '../actions/Activity.actions';
class ActivtyStore {
constructor () {
this.bindActions(ActivityActions);
}
}
export default alt.createStore(ActivtyStore);
```
With that i'm getting a ReferenceError: ActivityStore is not defined from alt Object.createStoreFromClass. If I add any method, the error no longer occurs.
``` js
import alt from 'altInstance';
import ActivityActions from '../actions/Activity.actions';
class ActivtyStore {
constructor () {
this.bindActions(ActivityActions);
}
onUpdateActivityQueue (activity) {
this.setState({activity});
}
}
export default alt.createStore(ActivtyStore);
```
Also if I pass the class into the alt.createStore method, it does not have the issue.
Contributor guide
Research direction
Start at alt.createStore and Object.createStoreFromClass, then reproduce the constructor-only store case from the issue. Done means the class creates without a ReferenceError while the existing case with an additional method and direct class usage continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100