Open aaronkyle opened 2 years ago
Yeah, the issue here is that the embed code is observing everything in the notebook. If you look at the compiled source of the notebook (https://api.observablehq.com/d/075a638054c366e7.js?v=3) you’ll see that both viewof variable
and variable
are observable:
export default function define(runtime, observer) {
const main = runtime.module();
main.variable(observer()).define(["md"], _1);
main.variable(observer("viewof variable")).define("viewof variable", ["Inputs"], _variable);
main.variable(observer("variable")).define("variable", ["Generators", "viewof variable"], (G, _) => G.input(_));
return main;
}
The embed code will need to have some logic in that says to not observe variable
if viewof variable
is already observed.
As a workaround, you can select just the cells you want to embed rather than the entire notebook.
Describe the bug When I create a selection input in editor mode, I see only the selection. In the embed mode, the variable is duplicated
To Reproduce Steps to reproduce the behavior: View this as embedded: https://observablehq.com/d/075a638054c366e7 https://observablehq.com/embed/075a638054c366e7
Expected behavior I expect just the input
Screenshots![embed-duplicates-viewof-select-element](https://user-images.githubusercontent.com/2301690/180656869-720ae22e-c0be-4761-acc2-bf62b624520c.jpg)
Desktop (please complete the following information):