Detached cell
In the following notebook I get a cell marked <detached>
https://observablehq.com/d/53f57fbb8e2305ae
What does it mean? Why is it?
Cell with continuous spinning circle
Also if I define my reference cell with viewof
I get a referring cell that never resolves and get a continuously spinning circle …
Thanks in advance
1 Like
An HTML element can only appear once in the page. In the context of Observable’s reactive runtime, when the output of a cell is referred to elsewhere, only one can appear. Thus Observable generates a placeholder element that says <detached>
. if you’d like multiple copies of the same HTML element, you can always clone it. Thus, in your logouse
cell, you might have ${logo.cloneNode(true)}
, rather than just ${logo}
.
The reason an element can only appear once is due to the internal representation of the webpage called the DOM, which has a tree structure by design. One characteristic of a tree is that each node has only one parent. The consequence is you can’t place it in two spots at the same time. This is a general HTML/Javascript issue and not at all unique to Observable. I do think you see it arise here more often due to the reactive environment and attempts to reuse output as you have done.
I can’t replicate that behavior in either Chrome or Firefox on my Mac. It’s worth pointing out though that logo2
and viewof logo2
are two different things. Typically, viewof logo2
would be an HTML element and logo2
would be just an associated value. As a result, I wouldn’t expect the use of logo2
to work, if you want to replicate the image viewof logo2
.
1 Like
Thanks for the explanation about <detached>
.
So you do not see the spinning circle for the cell logoUse2
in the notebook, don’t you?
I am using Brave but I see it also in Safari.
Here is a screenshot:
It continuously circle and nothing is shown…
2 Likes
Hmm… I do see it now; not sure how I missed it.
I suppose that your logoUse2
cell is waiting for logo2
to have a value before it resolves. But logo2
doesn’t have a value since viewof logo2
has no value property.
2 Likes