quantified-uncertainty / squiggle

An estimation language
https://squiggle-language.com
MIT License
150 stars 23 forks source link

Cache versioned package promises to avoid re-suspenses #3049

Closed berekuk closed 7 months ago

berekuk commented 7 months ago

Fixes #3014.

What happened:

So next-auth caused this because it causes re-renders on tab changes, but next-auth is not the problem here. Same problem also happened when you switched Squiggle versions (even if the version was loaded, use(...) still suspended)

One remaining issue here is related to SSR: on the initial load, the current sequence is: 1) SSR HTML, which shows some parts of the playground (but not CodeMIrror), because await import resolves on SSR immediately 2) then it suspends on the browser side use(versionedSquigglePackages) loads Squiggle lazily 3) then the full playground is rendered again

changeset-bot[bot] commented 7 months ago

⚠️ No Changeset found

Latest commit: 7b938ac206f1dd591ef189cbc24b9b8700e4899f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Feb 2, 2024 8:30pm
squiggle-website ✅ Ready (Inspect) Visit Preview Feb 2, 2024 8:30pm
2 Ignored Deployments | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **quri-ui** | ⬜️ Ignored ([Inspect](https://vercel.com/quantified-uncertainty/quri-ui/7FXqJDEveuStsZ8HFnDs6WnbKwEA)) | [Visit Preview](https://quri-ui-git-suspense-fixes-quantified-uncertainty.vercel.app) | Feb 2, 2024 8:30pm | | **squiggle-components** | ⬜️ Ignored ([Inspect](https://vercel.com/quantified-uncertainty/squiggle-components/9YB1Qsi3eVh7Z9YjVEy3jcA7Ukoh)) | [Visit Preview](https://squiggle-components-git-suspense-fixes-quantified-uncertainty.vercel.app) | Feb 2, 2024 8:30pm |