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

clear old content on undefine #1431

Merged
merged 1 commit into from
Jun 6, 2024
Merged

clear old content on undefine #1431

merged 1 commit into from
Jun 6, 2024

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jun 6, 2024

Fixes #1430. We were forgetting to clear old content when a cell is undefined during preview.

@mbostock mbostock requested a review from Fil June 6, 2024 15:42
@@ -119,7 +118,8 @@ function displayBlock(root, value) {
}

export function undefine(id) {
cellsById.get(id)?.variables.forEach((v) => v.delete());
clear(rootsById.get(id));
cellsById.get(id).variables.forEach((v) => v.delete());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the optional chaining here because we should only be undefining cells that were defined (and we want to notice if our logic is broken).

@mbostock mbostock enabled auto-merge (squash) June 6, 2024 15:56
@mbostock mbostock merged commit 7a25fc4 into main Jun 6, 2024
4 checks passed
@mbostock mbostock deleted the mbostock/fix-import-dup branch June 6, 2024 16:45
mbostock added a commit that referenced this pull request Jun 6, 2024
@mbostock mbostock mentioned this pull request Jun 6, 2024
mbostock added a commit that referenced this pull request Jun 6, 2024
* Revert "no wrapper span (#1416)"

This reverts commit e6af534.

* Revert "clear old content on undefine (#1431)"

This reverts commit 7a25fc4.
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.

Editing an imported module causes duplicate display
2 participants