fix issue with removeLinkStorages when specificaly querying the link field#388
fix issue with removeLinkStorages when specificaly querying the link field#388vparpoil wants to merge 7 commits intocult-of-coders:masterfrom
Conversation
|
I think the solution is in the graph preperation phase, not in the delivery. |
|
Can you indicate me which file/function you have in mind ? I have been searching for the As you can see in the code modified in this PR, the code removing the field is not testing for the |
|
I think you should check It seems that order matters but it should not. Solution could be to first separate db fields, linkers and reducers and add the db fields first and then other types of fields. |
|
Thanks for the insight ! |
|
@theodorDiaconu Here is an updated version modifying the body keys order to add the fields first to the CollectionNode. Let me know if you think it is not the good way to handle this. |
|
|
||
| function sortFieldNames(body) { | ||
| const bodyCompareFunction = function (key, value) { | ||
| // push fields first |
There was a problem hiding this comment.
Not sure if sorting is the right idea here. It may fail for nested links. I think the solution is to not mark the field as scheduled for deletion, or use it above the link.
There was a problem hiding this comment.
Yeah, with that sorting function we are doing kind of a guesswork. Why not make this process 2-pass? First, we determine what are props, fields, reducers and links. Second, we add them. Props and fields first, then links and reducers.
There was a problem hiding this comment.
Thank you for your time reviewing
Since the fields are not yet added in _shouldCleanStorage, the hasField method cannot see that the field is supposed to be there.
We could update this line and change it with
result = !this.hasField(node.linkStorageField, true) && !(node.linkStorageField in node.parent.body)Would that be a better solution @theodorDiaconu ?
|
@theodorDiaconu @vparpoil tests are now passing, so I want to inquire how you two feel about merging this. |
|
Hi @StorytellerCZ , I don't feel very confident myself because I was expecting some approval from @theodorDiaconu |
This commit fixes this issue #386
Tests are still passing locally