-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Binding child should happen in bind no init #5304
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
Conversation
It should fix several issues related to child caching wrong root, the one I was dealing with was that child of a `many=True` serializer didn't have access to context.
Hi @sassanh. A test case demonstrating the described issue would be helpful.
|
@rpkilby sure, I'm currently out of time but I'll add a test asap. I saw some hacks introduced in stackoverflow to pass context to child of ListSerializer. This bug + those stackoverflow posts leads people to complicated code. It would be great if we merge it first and create another issue assigned to me to add test in future as I think I won't have free time in near future. Or maybe someone can write the test now. I was thinking about adding a |
Actually if you don't access |
That looks suspicious to me. I can't double check but I'm pretty sure this part is already working fine. |
@rpkilby @xordoquy I added a test case that demonstrates how children can cache wrong root. It doesn't only happen if you access |
@rpkilby Yeah the problem is the same, but the way to produce it is not by binding a field manually like it's described there so your suggestions about overriding the main problem I dealt with in real life was that even though I didn't access So I think we should either invalidate cache when needed or revert #3288 as it doesn't introduce any performance benefits as you said in the other thread:
|
Thanks |
Note: Before submitting this pull request, please review our contributing guidelines.
Description
It should fix several issues related to child caching wrong root, the one I was dealing with was that child of a
many=True
serializer didn't have access to context.