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

Mutation of static backend prop on Model #37

Closed
diffcunha opened this issue Sep 10, 2016 · 1 comment
Closed

Mutation of static backend prop on Model #37

diffcunha opened this issue Sep 10, 2016 · 1 comment

Comments

@diffcunha
Copy link
Contributor

I found that if we set backend on a Model and then start a session with schema.withMutations(...) (for bootstrap for instance) this will change the static backend prop setting withMutations to true. From this point on every time we make a change we are literally mutating the store.

The bug is in Model.js file

// Model.js
static getBackend() {
    if (!this._sessionData.backend) {
        const BackendClass = this.getBackendClass();
        const opts = this._getBackendOpts();

        if (this.session && this.session.withMutations) {
            // HERE! This will mutate the static prop `backend` on the Model
            opts.withMutations = true; 
        }

        // ...
    }
    return this._sessionData.backend;
}
diffcunha added a commit to diffcunha/redux-orm that referenced this issue Sep 10, 2016
@tommikaikkonen
Copy link
Collaborator

Fixed in release 0.8.3

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