athens icon indicating copy to clipboard operation
athens copied to clipboard

Embedding block on same page freezes Athens

Open ddauber opened this issue 3 years ago • 3 comments

Problem

When embedding a block in itself it freezes Athens.

Ideally, it either gives a warning that this is not possible or it can handle self-embeds. Admittedly, this is likely an unusual scenario, but it happened when I experimented with it.

Athens Version Beta 76

ddauber avatar Apr 27 '21 09:04 ddauber

Can reproduce^^

sawhney17 avatar Apr 27 '21 11:04 sawhney17

This seems to be a rendering problem: I believe Athens tries to render the total tree down to its leaves, but it's not a tree but a circular graph!

I see some possible ways to fix this:

  1. collapse blocks in an embed environment per default. This requires some design changes in the behavior of blocks inside an embedded block. Currently, children of an embedded block, rendered in the embedding, are expanded if and only if the original child block, rendered outside the embedding, is expanded (spooky action at a distance, might be bug or feature...). See this Loom demo -- I hope I explained it well.
  2. We could also choose that the page view only renders the tree up to a depth of 20.
  3. Still another option: Cycle detection and children that are their own ancestors in the rendered tree don't render their children.

However, a block has two (grand-)children referencing to itself, option 2 would still get pretty exponential. I don't like the user experience of option 3, so I would favor option 1.

datokrat avatar May 24 '21 16:05 datokrat

@datokrat It seems it has nothing to do with the fact that the current block is on the same page. I can embed blocks from the same page.

The issue appears when you try to embed a block that is an ancestor of the current block. Athens will then end up in an endless loop which causes the freeze, because the embedded block contains an embedded block to itself.

martin-braun avatar Sep 10 '22 15:09 martin-braun