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

null entries in value array #49

Open
mortenbock opened this issue Nov 15, 2016 · 2 comments
Open

null entries in value array #49

mortenbock opened this issue Nov 15, 2016 · 2 comments

Comments

@mortenbock
Copy link

A customer of ours managed to bring the "value" of the property in a state where it was similar to this:

value: [
    {id:1234},
    null,
    {id:1234},
]

So somehow one of the items in the array was null.

This cause two things:

  1. The datatype failed, because it tried to access the id property of a null object

  2. The frontend failed because the value converter tried ti access properties on a null json object.

I have not been able to reproduce how the null got there in the first place, but it would be nice if the two scenarios above where more null tolerant :)

I fixed the datatype by adding a null check around the building of the renderModel:

if( $scope.model.value ) {
    _.each($scope.model.value, function( item, i ) {
        if (item !== undefined && item !== null) { //Check for null
            $scope.renderModel.push(new Link(item));
            if( item.id ) {
                (item.isMedia ? mediaIds : documentIds).push( item.id );
            }
        }
    });
}
@cheeseytoastie
Copy link

I think I've seen this where the Back Office is slow to load. They click Save and Publish before the custom property editor has fully loaded and then NULLS are stored. I can't quite remember what site this was on buy I hope this helps... are they on an older Umbraco?

@mortenbock
Copy link
Author

@cheeseytoastie It's a 7.5 install, so not very old.

It's just weird how one of the items is null. Maybe if that item was just a node id, and it uses a async call to populate the value or something.

I've still not been able to reproduce, and it has not happened since.

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