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

Dependencies cache issue on the server #2284

Closed
oliviertassinari opened this issue Aug 13, 2019 · 11 comments
Closed

Dependencies cache issue on the server #2284

oliviertassinari opened this issue Aug 13, 2019 · 11 comments

Comments

@oliviertassinari
Copy link

🐛 bug report

Description of the problem

I believe there is a caching issue with the server-side containers. Running the following url https://codesandbox.io/s/github/mui-org/material-ui/tree/master/examples/nextjs should start a project with the latest version of the dependencies. It seems that it's not the case for Material-UI. From what I can observe, it pulls our v3 instead of v4.

How has this issue affected you?

The problem was reported by one of our users in mui/material-ui#16979.

Link to sandbox

@lbogdan
Copy link
Contributor

lbogdan commented Aug 13, 2019

Hey @oliviertassinari ,

I think this #2075 (comment) should maybe address your issue?

@oliviertassinari
Copy link
Author

oliviertassinari commented Aug 13, 2019

Ok, I think that we can try "post-update": "yarn upgrade" to workaround the limitation. Thanks

@lbogdan
Copy link
Contributor

lbogdan commented Aug 14, 2019

Nice! Closing this for now, please reopen if you encounter further issues. Also, for more general questions, you can open a thread on Spectrum.

@lbogdan lbogdan closed this as completed Aug 14, 2019
@oliviertassinari
Copy link
Author

oliviertassinari commented Aug 14, 2019

We went for not applying this patch. The example is optimized for people starting a new project. They copy and paste the source, we shouldn't mix the concerns.

@oliviertassinari
Copy link
Author

oliviertassinari commented Feb 7, 2020

Is there a way to solve this problem without leaking the concern outside codesandbox?

@lbogdan
Copy link
Contributor

lbogdan commented Feb 7, 2020

We're always open to suggestions. 🙂

@oliviertassinari
Copy link
Author

I was wondering, maybe we could use an env variable to conditionally apply the command?

 "scripts": {
    "dev": "next",
    "build": "next build",
-   "start": "next start"
+   "start": "next start",
+   "post-update": "[[ -n $CODESANDBOX ]] && yarn upgrade --latest"
  }
}

But then, what about Windows 🙃 cc @garethx

@lbogdan
Copy link
Contributor

lbogdan commented Feb 7, 2020

But post-update has no meaning outside CodeSandbox, anyway?

@oliviertassinari
Copy link
Author

@lbogdan I didn't know that. I thought it was a npm command I wasn't aware of. I think that if it were prefixed with codesandbox-post-update, it would have been trivial to figure it out, as well for our users to feel confident removing the line once they clone the examples :).

@lbogdan
Copy link
Contributor

lbogdan commented Feb 7, 2020

Yeah, we modeled it after post-install, which is a npm thing, and named it post-update because it's supposed to run whenever the git repo updates. Whether we should have namespaced it with the codesandbox- prefix I think it's up for debate. 🙂

@oliviertassinari
Copy link
Author

@garethx what do you think about reopening the pull request, for all our demos with this approach?

 "scripts": {
    "dev": "next",
    "build": "next build",
-   "start": "next start"
+   "start": "next start",
+   "post-update": "echo \"codesandbox preview only, need an update\" && yarn upgrade --latest"
  }
}

@lbogdan Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants