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

Cannot get the children of first layer block when viewing the frontend of a revision #975

Open
tom20064028 opened this issue Dec 18, 2024 · 2 comments
Labels
bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required bug report

Comments

@tom20064028
Copy link

tom20064028 commented Dec 18, 2024

Bug Description

Hi all,
I am using Neo to create a two level looping content list. The content structure is something like this. There are multiple
"testParent" blocks which can contain multiple "testChildren" blocks.
screen-1
The frontend template of this entry is something like this for debug.

{{ dump(entry.testField.level(1).all() )}}
{% for item in entry.testField.level(1).all() %}{{ dump(item.children.all()) }}{% endfor %}
{{ dump(entry.testField.all())}}

And everything is fine. The first dump function is printing the list of level 1 "testParent" block. The second dump function is printing the list of level 2 "testChildren" blocks of each "testParent" Block. And the third dump function is printing all the block without considering the level and there is three blocks in total.
image
But when switching to one of the previous revision, the cms page can still show the correct blocks with the correct structure. For ruling out other factors, the difference between two version is just the text in the text field but no action on the block structure.
image
When we view the frontend with the same template by clicking the "View" button at the top right corner of the panel,
image
the second dump function is printing an empty array which means we cannot get the level 2 "testChildren" blocks of each "testParent" block by the function item.children.all(). I have tried to study the reasons behind but only find that the relations between blocks in different level are lost in revision. Whatever I use .children for level 1 blocks or use .parent for level 2 blocks, I can't get anything. Do anyone have any idea about this case.

Steps to reproduce

  1. Create a neo field containing two type of block, one is for parent block and one is for child block
  2. Append the field to any entry. Create a parent block and create a child block as the sub-block of parent block
  3. Change the text content of the neo block
  4. Go to the revision which the text content hasn't been changed and view the frontend view of the revision.

Expected behaviour

Able to query the second level blocks from the first level blocks.

Neo version

5.2.20

Craft CMS version

5.4.9

What is the affected Neo field's propagation method?

No response

Does this issue involve templating, and if so, is eager-loading used?

This is a templating issue, and eager loading is not used

@ttempleton
Copy link
Contributor

If the blocks were cloned or pasted, they might be affected by #961. Try cloning them and let me know how that goes.

@ttempleton ttempleton added bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required and removed bug report status: new labels Dec 18, 2024
@tom20064028
Copy link
Author

Thanks for your reply but seems that it may not related to the cloning or pasting action since I haven't do these action before . I am just changing the content and view the frontend of last revision.
But for your information, here is the result for cloning. I have clone each "testChildren" to get the second and forth block and I can query all four children blocks in the frontend.
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required bug report
Projects
None yet
Development

No branches or pull requests

2 participants