keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.64k stars 2.2k forks source link

Fix incorrect behavior with default values #4927

Closed ttsirkia closed 5 years ago

ttsirkia commented 5 years ago

Fixes #4737

ttsirkia commented 5 years ago

The main issue is that the default value should be used only if the current value is not defined at all.

laurenskling commented 5 years ago

@JedWatson how would we write a test for this?

chrisschaub commented 5 years ago

Is this really a problem with this pull request, or with the build to test path? I think there are other build tests that were failing that is blocking this. This code needs to make it into the next release, it's a breaking core feature.

JedWatson commented 5 years ago

Going to merge this so we can get it released.

I've had a look at why this isn't covered in the tests, and we don't actually have a field config set up in the test schema that triggers this condition; so I'll add a TODO for it

Thanks @ttsirkia

chrisschaub commented 5 years ago

Thanks!