Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stumped by this #687

Open
sjatkins opened this issue Oct 2, 2016 · 1 comment
Open

stumped by this #687

sjatkins opened this issue Oct 2, 2016 · 1 comment

Comments

@sjatkins
Copy link

sjatkins commented Oct 2, 2016

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?

@philstrong
Copy link

philstrong commented Oct 10, 2016

Suggest making your snippets a code block

if (blah) {
    doSome();
}

It's impossible to read this and no one is going to take the effort if you don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants