Broken notebook

I created these notebooks a while back and it appears to be broken now but with no errors. I have no idea where to start to find the problem. Any hints would be welcome!


Do you know the side bar (on right) gives you a window into the dataflow, so you can try and use that to track down cells that are not running (grey bar on left)

For the first one I am suspicious that the current_date is never set, for instance.

@tomlarkworthy thanks! Yes, I agree. That value is set in a closed function at the top of the notebook, but for some reason it doesn’t seem to be executing (it used to!) so the question is now, why isn’t it? I’m guessing that something changed in Observable the last year that broke this but not sure what that might be.

With { console.log(“running”) … } at the top of that cell I see it does not run. Why? with some bisection of deleting code I see the variable “map” is not resolved.

try typing just “map” in a cell

viewof map = {
  const container = html`<div style="height:650px;">`;
  yield container;

  const map = container.value = ...

You update the “value” after yielding the container. So when you yield the value is “undefined” which is like it has not run. So if you do another yield as the last statement in the block it will work or you can do

container.dispatchEvent(new Event('input', {bubbles: true}))

to specifically tell the runtime you have updated the ‘value’ and not the container reference

1 Like

That’s it! I would have never seen that without your help. Thanks!

1 Like

Hi Tom,
I’m at this problem again – your solution worked fine. However, the “decay” functionality doesn’t work as it used to. The points should remain in the heatmap – IOW, not immediately disappear from the heatmap display. The timeout function with decay used to work well, but now no longer (since the fix). Do you have any ideas?
FYI, I’m now working in the Humanitarian sector in Burkina Faso, and am trying to use this general map design to eventually map deaths of civilians in conflict areas as well as other events. But I’ve lost some of my agility to figure out the coding for this sort of thing. Any help would be much appreciated.

Ah… noticing some errors with leaflet.js. I’m looking into that. Don’t think that was the issue. Something in the time.scale functionality seems to have changed. If I manually set the duration, it works as expected. I’ll find out now why delay(incident.treatment_finished) - delay(incident.declared); is returning an unexpected negative value.


Hi sorry. I don’t have any spare cycles at the moment.