Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix stale display #997

Merged
merged 1 commit into from
Mar 6, 2024
Merged

fix stale display #997

merged 1 commit into from
Mar 6, 2024

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Mar 6, 2024

The display function now captures the current version whenever the inputs (other than display and view) change, such that when a variable is invalidated, it gets a new display function capturing the new version. And, we now throw an error if display is called with a version that is older than the last-displayed content. Users should never see this error (unless they use developer tools to break on caught exceptions), but it also prevents downstream work for a variable that has been invalidated, which is nice.

I had to reach into the Runtime internals to get this to work, because I wanted shadow variables that depend on other variables. (Normally shadow variables aren’t allowed to have any inputs, but it’s really just a limitation of the shadow option, not the underlying implementation.)

Fixes #995.

@mbostock mbostock requested a review from Fil March 6, 2024 17:07
@mbostock mbostock merged commit d6311b5 into main Mar 6, 2024
4 checks passed
@mbostock mbostock deleted the mbostock/fix-stale-display branch March 6, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stale async displays
2 participants