coderedcms icon indicating copy to clipboard operation
coderedcms copied to clipboard

RecursionError using Latest Pages block with article pages

Open pascalthivierge opened this issue 4 years ago • 4 comments

Describe the bug

When using Latest Pages block on an article page, and selecting parent article landing page as source, if the current article page is in the listed latest pages, it crashes. The article landing page is also crashing.

Steps to reproduce

Steps to reproduce the behavior:

  1. On an article page, use the Latest Pages block
  2. Select parent page of current article as source
  3. Select any number of pages to list, making sure the current page will be listed with the ordering specified in the parent’s LAYOUT tab.
  4. RecursionError

Expected behavior

It should list all latest pages, including or excluding the current page.

pascalthivierge avatar Sep 24 '20 14:09 pascalthivierge

Yes, this is a known bug. Thanks for reporting it with detailed steps to reproduce.

I'm not sure on the best way to solve this. One way would be to not allow selecting an ancestor of the current page in the latest pages block. Open to suggestions or a pull request if you have any ideas. Regardless, there should be better documentation with a warning about this behavior!

vsalvino avatar Sep 24 '20 15:09 vsalvino

Ok, your post #155 explains the known behavior.

IMHO, being able to select an ancestor is a must...

Would it be possible to simply exclude the current page from results, to avoid recursion?

pascalthivierge avatar Sep 24 '20 15:09 pascalthivierge

Excluding the current page is not enough. If you select an ancestor (say a blog landing page) that page could render the sub-pages on it, as part of its content. Which then must load the current page in order to render the blog landing page. So there is simply no way to guarantee there won't be recursion - each page could be totally different based on what content the developer has put on it.

It's not just limited to ancestors. Say we have a Home Page which has two children, A and B. If A has a preview or latest pages of B, that will work. But if B also tries to do a preview or latest pages of A, you now have a recursion problem.

vsalvino avatar Sep 24 '20 15:09 vsalvino

hmm...

Since page preview listing is not, strictly speaking, real content... maybe it should be excluded from content previewing. Does it make sense?

pascalthivierge avatar Sep 24 '20 16:09 pascalthivierge