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

Bug with sorting content elements after containers #457

Closed
koehnlein opened this issue Oct 31, 2023 · 3 comments
Closed

Bug with sorting content elements after containers #457

koehnlein opened this issue Oct 31, 2023 · 3 comments

Comments

@koehnlein
Copy link

Hi have a page with a lot of content elements, some inside containers and some outside containers. And I have found the following bug:

When I want to sort an element after a container, or create a new content element after the container, the calculated new sorting value, is based on the sorting of the inner content element instead of the container.

The problem seems to be this code

if (empty($childRecords)) {
where you handle containers with content differently than empty containers.

See this example. We want to move "Content Element 2" after the container. In the mentioned code, the check if (empty($childRecords)) would fail, because there are children. This would cause, the last child will be returned and used for sorting. And this would be cause that the new sorting value would be calculated based on 256 instead of 4608. And this would cause, the element would not be placed after the container but somewhere else.

+ Content Element 1, sorting 4096

+ Content Element 2, sorting 4352

+ Container, sorting 4608
   + Content Element 3, sorting 256

+ .... here I want to place the content element ....

See also this short video clip where I show the problem: Link to MP4 video

@achimfritz
Copy link
Contributor

@koehnlein did you run the container.sorting --apply command (s. https://github.com/b13/container/releases/tag/2.0.0) looks your "Content Element 3, sorting 256" is wrong, because it should be sorted after "Container, sorting 4608"

@koehnlein
Copy link
Author

@achimfritz Thanks, that helped! Would you recommend to regularly execute it? Or should everything be fine after doing it once.

@achimfritz
Copy link
Contributor

regularly execution is not required. (as long as no other sorting bug appears)

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

2 participants