You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are fields I exclude from my client side application to not allow editing them. These fields are not passed to the endpoint and are being set to null by feathers-knex. This is what I would consider an unexpected behavior.
I would like to change this so that fields that are not passed into the rest endpoint are kept as is.
for(varkeyofObject.keys(oldData)){if(data[key]===undefined){newObject[key]=oldData[key]||null;// <--note reusing old data }else{newObject[key]=data[key];}}
Expected behavior
Keys that are not passed to feathers should not be changed.
Actual behavior
These keys are set to null.
Thoughts??
Module versions (especially the part that's not working):
feathers-knex@3.0.1
NodeJS version:
8.9.4
Operating System:
Windows 7
Browser Version:
Chrome 64
Module Loader:
Steal.js
The text was updated successfully, but these errors were encountered:
It is making a copy and not modifying the original object. The behaviour you are seeing is as intended by the update method:
completely replaces a single record identified by id with data
So the old data will be replaced by the new, removing existing fields if they don't exist in the new data. If this is not what you want then you should patch instead.
Related: #55
Steps to reproduce
There are fields I exclude from my client side application to not allow editing them. These fields are not passed to the endpoint and are being set to null by feathers-knex. This is what I would consider an unexpected behavior.
I would like to change this so that fields that are not passed into the rest endpoint are kept as is.
https://github.com/feathersjs-ecosystem/feathers-knex/blob/master/lib/index.js#L288
Expected behavior
Keys that are not passed to feathers should not be changed.
Actual behavior
These keys are set to null.
Thoughts??
Module versions (especially the part that's not working):
feathers-knex@3.0.1
NodeJS version:
8.9.4
Operating System:
Windows 7
Browser Version:
Chrome 64
Module Loader:
Steal.js
The text was updated successfully, but these errors were encountered: