records edit fields broken / fields.find is not a function
In case anyone has the same issue. When the fields are loaded in the admin user edit form, the data is deleted on save in certain circumstances - I believe it is to do with using fields that have deleted parent fields.
Because these fields are removed in the devent model, the array is no longer sequential and so when they are json_encoded like this
` $js = " var page = {} ; page.updateFee = function(){} ;var formFields = " . json_encode($fields) . ";";`
the formFields are encoded as an object not an array and everything falls down after that.
To fix just run the fields through $fields = array_values($fields) before encoding them.