Say I have a state slice that looks like the following:
{
"ids":[20,23,32,60,101],
"entities":{
"20":{
"id":20,
"name":"Actor",
"questions":[{
"id":20,
"role_id":20,
"field_type":"text",
"field_name":"Height",
"field_default_value":null,
"field_validation_rules":"required,string,max:5",
"answers":[{
"id":1,
"question_id":20,
"value":"Testing",
"created_at":"2019-07-30T13:20:09.000000Z",
"updated_at":"2019-07-30T13:20:10.000000Z"
}]
}],
"created_at":"2019-07-24T13:35:33.000000Z",
"updated_at":"2019-07-24T13:35:33.000000Z",
}
},
"allUserRolesLoaded":true
}
How would I go about updating that answer in my reducer, I was thinking that I would be able to use something like the following, but when trying to drill down into the questions and then answers I get all kinds of problems.
adapter.updateOne(
{
id: 2,
changes: {...state.entities[2], likes: value}
},
state
);
Now, I know that this should probably be normalised in someway, and usually I would, however, this isn't an option at this stage.