Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Problem in store: Uncaught ReferenceError: Invalid action reference passed in #1

Open
SH4DY opened this issue Nov 16, 2015 · 0 comments

Comments

@SH4DY
Copy link

SH4DY commented Nov 16, 2015

I implemented an example project exactly like this one but I'm getting Uncaught ReferenceError: Invalid action reference passed in. This error is thrown at runtime in my store at this.bindListeners: ClassName.methodName

I found the error on the altjs doc page, but my Actions are of the same structure as the one in the example:

interface Actions{
    refreshComponentLibrary():void;
    componentLibraryRefreshed(componentLibrary: MqtlComponent[]):void;
    componentLibraryRefreshFailed(errorMsg:string):void;
}

class ComponentLibraryActions extends AbstractActions implements Actions{

    constructor(){
        super(altInstance);
        this.generateActions(
            "refreshComponentLibrary",
            "componentLibraryRefreshed",
            "componentLibraryRefreshFailed"
        )
    }

    refreshComponentLibrary = () => {
        console.log("ACTION!!! Refresh comp library");
        this.dispatch();

        //Trigger async
        ComponentLibraryStore.fetchComponentsFromServer();
    }

    componentLibraryRefreshed = (componentLibrary: MqtlComponent[]) => {
        console.log("Dispatch action: Library refreshed");
        this.dispatch(componentLibrary);
    }

    componentLibraryRefreshFailed = (errorMsg: string) => {
        console.log("Dispatch action: Library refresh failed");
        this.dispatch(errorMsg);
    }
}

export = altInstance.createActions<Actions>(ComponentLibraryActions);

Tried it without the this.generateActions(...) too, but no luck...

Any idea whats going wrong here? I can't get this project to run either (gives me an error Error: ENOENT: no such file or directory, open '/Users/rlopezna/dev/alt-typescript-tutorial/typings/references.d.ts'after npm start)...

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

No branches or pull requests

1 participant