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

deleting a dependency of a cell causes 'Failed to load URL' #15

Open
jaked opened this issue May 1, 2024 · 2 comments
Open

deleting a dependency of a cell causes 'Failed to load URL' #15

jaked opened this issue May 1, 2024 · 2 comments

Comments

@jaked
Copy link
Collaborator

jaked commented May 1, 2024

instead it should cause an error about an undefined variable (when you delete the cell defining the variable).

I think maybe we aren't cleaning up the mapping of exported variables to cells?

@jaked
Copy link
Collaborator Author

jaked commented Jul 25, 2024

I can't reproduce this as described.

If I delete a depended-on cell, I get a ReferenceError (correct behavior).

If I delete the contents of the depended-on cell, or rename the depended-on variable, I don't get a ReferenceError, but the variable value is undefined. If I manually reexecute the depending cell then I get a ReferenceError.

@jaked
Copy link
Collaborator Author

jaked commented Jul 25, 2024

I think what's happening here is that we rewrite cells to import their dependencies, so e.g. if I have cells

const x = 7

and

x + x

then the second one is rewritten to

import { x } from [the first cell]

x + x

Now if you change the first cell (delete its contents or rename x), the second doesn't get rewritten, but importing the now-nonexistent variable returns undefined instead of throwing ReferenceError.

I think the right fix is to rewrite cells in light of current bindings when they are invalidated.

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

No branches or pull requests

1 participant