Closed rogeraraujo90 closed 10 months ago
@rogeraraujo90 apologies for the extremely late response. In case you're still having this issue (or for future readers of this issue) I believe the issue is as you indicate, that the LabelSerializer
for the child relationship is being created each time the constructor is called.
Unless there's something very custom that you're trying to achieve (that's not given in the context of this ticket) I think the easiest solution for you is to simply define a static instance of the LabelSerializer
which can then be used in the relator without needing to invoke the constructor which results in your infinite loop.
Hope that helps - if not then please provide some more context and I'll see how I can help
Closing as stale and not an issue with the library
Describe the bug*
When creating a bi-directional relationship with the Relator class the result is an infinity loop
To Reproduce*
I have a class called
Label
which has a "parent" property of theLabel
type. My serializer looks like this:When I call
labelSerializer.serializer.serialize(label)
the result is:RangeError: Maximum call stack size exceeded
The error is expected because of the constructor call, so I think we don't support bi-directional relationships or there is other API that is not documented to accomplish that.
Expected behavior*
I was expecting to see a serialized label with:
Platform*
Additional context
{{Add any other context about the problem here.}}
* means required.