Closed mdroidian closed 5 months ago
renderWithUnmount
is directly used in
<TldrawCanvas>
@dvargas92495 when a ComponentContainer
goes from rendered React Component to edit block node, how is the node's previous content (the node's :block/string
) being applied? Is Roam handling that? If we are, I haven't been able to find where we are doing that.
Example for query builder ResultsView
we call window.roamAlphaAPI.ui.setBlockFocusAndSelection
and the observer gets unmounted.
<MenuItem
icon={"edit"}
text={"Edit Block"}
onClick={() => {
const location = getUids(
containerRef.current?.closest(
".roam-block"
) as HTMLDivElement
);
window.roamAlphaAPI.ui.setBlockFocusAndSelection({
location: {
"window-id": location.windowId,
"block-uid": location.blockUid,
},
});
}}
/>
)}
Sorry, I think you can ignore that last question. I believe I found a different solution.
EDIT: more specifically: when a preceding sibling is added to an ancestor block
Example https://www.loom.com/share/af9dce45fe654b96a56aacb9ee5d60d0
It looks like the cause is
n.contains(p)
from renderWithUnmount@dvargas92495 , what case is
n.contains(p)
solving for thatn === p
doesn't?EDIT: further testing showed that
n.contains(p)
is used when a block is being edited or folded