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

Form save action incompatible with vertigo #1508

Closed
sanfinsm opened this issue Nov 15, 2017 · 1 comment
Closed

Form save action incompatible with vertigo #1508

sanfinsm opened this issue Nov 15, 2017 · 1 comment
Assignees

Comments

@sanfinsm
Copy link

Current behaviour

When saving an object, all its fields are set to null if they have not been filled.
This leads Vertigo to check for notNull fields, including the ID.
This behaviour prevents us from creating new instances.

Expected behaviour

Not setting the property at all would prevent the check on the java side.

Suggested fix in common/mixin/store-behaviour.js :

_buildEmptyFromDefinition() {
        if (this.buildEmptyFromDefinition) {
            return this.buildEmptyFromDefinition();
        }
        return Object.keys(this.definition)
            .reduce((acc, key) => ((__IS_VERTIGO__ || this.partialObject) && !this.refs[`${this.definitionPath}.${key}`] ? acc : { ...acc, [key]: null }), {});
}

Define IS_VERTIGO variable in webpack.config.js if necessary.
myConfig.addDefinedVariable('__IS_VERTIGO__',' true');

@Hartorn Hartorn self-assigned this Nov 17, 2017
Hartorn added a commit that referenced this issue Nov 19, 2017
#1508 : When saving, only partial data should be returned
@Hartorn
Copy link
Contributor

Hartorn commented Nov 22, 2017

Fixed in 2.2.2

@Hartorn Hartorn closed this as completed Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants