Skip to content

Fix: cannot remove objects by setting to null #549

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,10 @@ export class Model {
let ctx = context[name] || {}
let partial = this.getPartial(field, params)

if (value === null && field.nulls === true) {
rec[name] = null
if (value === null) {
if (field.nulls === true) {
rec[name] = null
}
} else if (value !== undefined) {
if (field.items && Array.isArray(value)) {
rec[name] = []
Expand Down Expand Up @@ -1612,7 +1614,7 @@ export class Model {
convertNulls(op, pathname, fields, properties, params) {
for (let [name, value] of Object.entries(properties)) {
let field = fields[name]
if (!field || field.schema) continue
if (!field) continue
if (value === null && field.nulls !== true) {
// create with null/undefined, or update with null property
if (
Expand Down