You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mootari
Fabian Iwand
Should there be an example for .finalize() + invalidation? It would seem that cleaning up after a view is especially important in the context of Observable, where cells can be rebuilt rather frequently.
@domoritz
Dominik Moritz
5 hours ago
Yeah, that would be good. I don't know how Observable signals unloading a cell. Do you have a suggestion?
@mootari
Fabian Iwand
1 hour ago
In each cell you have access to an "invalidation" promise that resolves when the cell is updated. To give a code example:
invalidation.then(() => view.finalize());
where view is the return value of the resolved promise that is returned by embed. The snippet is taken from https://observablehq.com/@mootari/optimal-tiling#view
More details about invalidation can be found at https://observablehq.com/@observablehq/invalidation
Suggested by @mootari
Relevant code in https://github.com/vega/vega-embed/blob/master/src/container.ts
Should work in https://observablehq.com/@vega/hello-vega-embed
The text was updated successfully, but these errors were encountered: