Closed vkbansal closed 8 years ago
this.actions
was removed in 0.18.0 I believe.
What do you mean by stores not respecting default state?
Here is my sample code.
// my-actions.js
"use strict";
import alt from "./alt";
class MyActions {
constructor() {
this.generateActions("load");
}
}
MyActions.displayName = "MyActions";
export default alt.createActions(MyActions);
// my-store.js
"use strict";
import { List } from "immutable";
import actions from "./my-actions";
import alt from "./alt";
class MyStore {
constructor() {
this.bindActions(actions);
this.state = {
variables: List(),
};
}
onLoad(data) {
let { variables } = this.state;
this.setState({
variables: variables.merge(data)
});
}
}
MyStore.displayName = "MyStore";
export default alt.createStore(MyStore);
Now I do the following
import actions from "./my-actions";
import store from "./my-store";
console.log(Object.keys(actions)); // IE10 => []; Others => ["load", "LOAD".....]
let { variables } = store.getState();
console.log(variables); // IE10 => undefined; Others => List
What happens if you remove immutable?
I have the exact same setup and issue; also using immutable. Would love to known why. Fixed by downgrading to 0.18.0 from 0.18.1. Using immutable 3.7.5.
I also have exactly the same problem. Alt 0.18.1, Immutable 3.7.6.
@goatslacker I have the same issue without Immutable. After some debugging, actions are correctly dispatched but the Stores constructor()
aren't called on initialization. I'm also using alt instances ;)
By any chance are you using this transpiled with babel or not?
Yes I'm
+1 I was getting the following error after upgrade from 0.18.0 to 0.18.2:
Object doesn't support property or method 'isLoading'
Downgrading to 0.18.0 fixed the issue.
Babel was updated to v6 for 0.18.2, this may have caused breakage. Investigating...
We can just downgrade back to babel5.
Upgraded babel and set it on loose mode for classes, 0.18.4 should work now
0.18.2
does not work in IE10 but0.18.0
does.