Skip to content

Onyx.merge does not remove a nested object key #301

Description

@thienlnam

If you set an object key to null, Onyx.merge will remove it

Object: {
	transactionID: 12312312
	comment: {
			waypoints: {
				waypoint0: {}
			}
     }
}

This works for first level keys
// Remove all first level keys that are explicitly set to null.

Onyx.merge(key, {
	transactionID: null
}

Corresponding object:

{
	comment: {
			waypoints: {
				waypoint0: {}
			}
     }
}

But if you try to remove a nested key

Onyx.merge(key, {
	comment: {
		waypoints: {
			waypoint0: null
		}
	}
}

It will just set the value to null

{
	comment: {
			waypoints: {
				waypoint0: null
			}
     }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions