goatslacker / alt

Isomorphic flux implementation
http://alt.js.org/
3.45k stars 323 forks source link

v0.18.2 does not work in IE10 #613

Closed vkbansal closed 8 years ago

vkbansal commented 8 years ago

0.18.2 does not work in IE10 but 0.18.0 does.

goatslacker commented 8 years ago

this.actions was removed in 0.18.0 I believe.

What do you mean by stores not respecting default state?

vkbansal commented 8 years ago

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
goatslacker commented 8 years ago

What happens if you remove immutable?

miguelbermudez commented 8 years ago

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.

richardriman commented 8 years ago

I also have exactly the same problem. Alt 0.18.1, Immutable 3.7.6.

iam4x commented 8 years ago

@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 ;)

goatslacker commented 8 years ago

By any chance are you using this transpiled with babel or not?

vkbansal commented 8 years ago

Yes I'm

am80l commented 8 years ago

+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.

goatslacker commented 8 years ago

Babel was updated to v6 for 0.18.2, this may have caused breakage. Investigating...

https://github.com/goatslacker/alt/compare/v0.18.0...v0.18.2#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R14

goatslacker commented 8 years ago

https://phabricator.babeljs.io/T3041

goatslacker commented 8 years ago

We can just downgrade back to babel5.

goatslacker commented 8 years ago

Upgraded babel and set it on loose mode for classes, 0.18.4 should work now