-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue with removeLinkStorages when specificaly querying the link field #388
base: master
Are you sure you want to change the base?
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. |
@@ -82,6 +84,23 @@ export function createNodes(root) { | |||
} | |||
} | |||
|
|||
function sortFieldNames(body) { | |||
const bodyCompareFunction = function (key, value) { | |||
// push fields first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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