observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
961 stars 83 forks source link

RuntimeError: stdlib.Generators.observe is not a function #213

Closed jamwalla closed 3 years ago

jamwalla commented 3 years ago

Describe the bug When embedding cells using the Runtime library, following the example for custom fluid width, the redefined width causes a RuntimeError: stdlib.Generators.observe is not a function which is displayed on the embedded page instead of the chart.

To Reproduce Steps to reproduce the behavior:

  1. See https://www.vera.org/covid-19/criminal-justice-city-and-state-spotlights/michigan
  2. Scroll to just below "Select a county" and see error:
    chart = RuntimeError: stdlib.Generators.observe is not a function
    update = RuntimeError: stdlib.Generators.observe is not a function
  3. See https://www.vera.org/code/michigan-jail-population-and-covid.js for the redefined width

Expected behavior chart cell inherits parent width and resizes with the window.

Screenshots

Screen Shot 2021-05-25 at 11 56 59 AM
mbostock commented 3 years ago

This was broken in https://github.com/observablehq/stdlib/pull/207. You can fix this by pinning the runtime version to 4.8.2 (the first broken version is 4.9.0).

import {
  Runtime,
  Inspector,
  Library,
} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4.8.2/dist/runtime.js";

That example is using an internal API that we inadvertently changed. I’ll see if we can push a patch that restores backwards compatibility, and update that example to use a public API.

jamwalla commented 3 years ago

Pinning to 4.8.2 did the trick. Thank you for the very quick fixes!