stumped by this
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 312
- PR merge metrics
- No merged PRs in 30d
Description
My actions don't seem to get to my stores when fired. Or at least some of them don't. I am in an ES6 environment if that matters. Here are what I think are the relevant snippets. Any clue what I should do differently much appreciated.
`class RememberActions {
constructor(){
}
setClass(classId) {
let setObject = this.setObjectData.bind(this);
model.createObject(classId).then(
obj => {
setObject(obj, [], [], []);
return obj;
}
);
}
setObjectData(objData, tags, groups, roles){
let cls = utils.objectClass(objData);
return {
tags: tags,
groups: groups,
roles: roles,
object: objData,
expandedClass: model.getExpandedClass(cls)
}
}
export default alt.createActions(RememberActions);
'
and store like..
`
class ObjectStore {
constructor () {
Object.assign(this, defaultState);
this.bindListeners({
setObject: remember.setObjectData,
setAttribute: remember.setAttr,
setObjectNeighbors: remember.setNeighbors,
changeAssociation: remember.setAssociated,
removeAssoc: remember.removeAssociation,
});
}
setObject(objData) {
Object.assign(this, defaultState);
this.objectId = objectUUID(objData.object);
this.tags = objData.tags;
this.groups = objData.groups;
this.roles = objData.roles;
let cls = objData.expandedClass;
this.className = cls.name;
this.objectRef= cls.name + '(' + this.objectId + ')';
this.attrMap = cls.attrs.map(
(x) => [x, objData.object[x.name]]);
}
}
export default alt.createStore(ObjectStore, 'ObjectStore');
`
I see the relevant action method firing fine in devtools when a setClass fires but the store method supposedly bound to it never fires. What am I doing wrong?
Contributor guide
Research direction
Start with the RememberActions.setClass and setObjectData snippets, then inspect the ObjectStore constructor and its bindListeners call. Trace whether the action created by alt.createActions dispatches the bound method, and verify the store's setObject handler is reached when setClass runs. Done means the relevant action consistently updates the store.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100