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

Codesandbox preview never updates the worker #545

Open
kettanaito opened this issue Jan 18, 2021 · 3 comments
Open

Codesandbox preview never updates the worker #545

kettanaito opened this issue Jan 18, 2021 · 3 comments
Labels
bug DX good first issue help wanted

Comments

@kettanaito
Copy link
Member

@kettanaito kettanaito commented Jan 18, 2021

The issue

Our pull requests use a Codesandbox integration to generate a preview sandbox for the changes. While it correctly pulls the state of the msw package, it doesn't update the public/mockServiceWorker.js file as a part of the preview. This can lead to a broken sandbox once we introduce a breaking change to the client-worker communication.

Expected behavior

I'd expect Codesandbox config to support some bootstrap event where we could pull the mockServiceWorker.js file relevant to the built pull request (it doesn't have to be the latest, as pull requests may also change the worker file).

@kettanaito kettanaito added bug DX labels Jan 18, 2021
@kettanaito
Copy link
Member Author

@kettanaito kettanaito commented Jan 18, 2021

@msutkowski, hey, Matt 👋 Do you know if it's possible to execute some logic before Sandbox builds its preview?

@kettanaito
Copy link
Member Author

@kettanaito kettanaito commented Feb 6, 2021

It should be possible to use the startScript option of the codesandbox.config.json to execute a custom script whenever the sandbox starts. I cannot edit our MSW React template as the entire site gets broken once I unfreeze the template.

@kettanaito
Copy link
Member Author

@kettanaito kettanaito commented Feb 14, 2021

I've added the startScript option to the condesandbox.config.json, but it still doesn't execute that command before preparing the sandbox. I can clearly see the latest published worker instead of the latest commit worker per pull request it tries to preview.

Anytime I try to edit Codesandbox config live the entire page freezes and goes out of memory. I'm suspecting a Codesandbox issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug DX good first issue help wanted
Development

No branches or pull requests

1 participant