observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.13k stars 85 forks source link

Editing an imported module causes duplicate display #1430

Closed mbostock closed 3 weeks ago

mbostock commented 3 weeks ago

1416 introduced a bug where old displays are not cleaned up when imported modules change. To reproduce, create a JavaScript fenced code block like so:

```js echo
import {test} from "./test.js";

display(test);

Then create the `test.js` like so:

```js
export const test = 2;

Edit test.js and you will see the bug:

Screenshot 2024-06-06 at 8 26 19 AM