Skip to content
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

First Item In Rendered List is not de-proxied #363

Open
davymitchell opened this issue Jan 10, 2022 · 1 comment
Open

First Item In Rendered List is not de-proxied #363

davymitchell opened this issue Jan 10, 2022 · 1 comment

Comments

@davymitchell
Copy link

Experiencing an odd bug rendering a JSON list as part of a Rest API.

I am finding if the list of DO's contains a proxy object as the first item of a list, the view renders it as 'null' other proxy objects are rendered as expected.

If the first item is not a proxy, then all objects are rendered as expected.

My workaround is to do something like this:
if (items.size() > 0) {
items[0] = GrailsHibernateUtil.unwrapIfProxy(items[0]) as DO)
}
But this doesn't seem like a great or scalable solution.

Grails 4.0.13 Views-json 2.0.4

@davymitchell
Copy link
Author

I have also noticed that the automatic de-proxying is not always accurate. For example if item 8 of a list of ten is proxied, then it will be populated with the contents of item 7.
This has let me to deproxy the entire list always which feels like something the framework should take care of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant