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

Seed reset shouldn't lose collapse/expand state #3448

Open
berekuk opened this issue Nov 20, 2024 · 1 comment
Open

Seed reset shouldn't lose collapse/expand state #3448

berekuk opened this issue Nov 20, 2024 · 1 comment

Comments

@berekuk
Copy link
Collaborator

berekuk commented Nov 20, 2024

No description provided.

@berekuk
Copy link
Collaborator Author

berekuk commented Jan 14, 2025

This is complicated.

On seed reset, the playground re-renders with the new environment, which causes this code in useSimulator to return undefined:

  const output = project.hasHead(renderedHeadName)
    ? project.getOutput(renderedHeadName)
    : undefined;

(the head is there, but project.getOutput looks for the output based on the hash(module, environment) with new environment, so output is not there)

Because the output is missing, the playground renders the right panel without the viewer, and so without the ViewerProvider, and its state gets lost.

There might be several ways to fix this, but the one that looks the least like a workaround to me is to implement per-head environments in SqProject. I don't remember the details, but I remember it's not trivial, see e.g. this comment:

// TODO: environment should be per-head. But it's difficult because we'd have
// to track outputs per-head, and for that we'd have to store information
// about which heads require which modules.
environment: Env;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 To prioritize
Development

No branches or pull requests

1 participant