🏠 back to Observable

Have object display expanded on page load


#1

When a cell represents a JavaScript object is there a way to have it display expanded one level by default?

I’m walking up the DOM from another cell and trigger a click on it - which is contrived at best. If someone has a better way of doing it would be much appreciated!


#2

We don’t currently have a good way to do this, sorry.


#3

I didn’t think so - couldn’t find it.
In my case the object being displayed is in a while/await/yield loop, so I update the <span class>
observablehq--collapsed entry to observablehq--expanded, then resolve the promise that it is waiting on.