Skip to content

v0.9.12

Compare
Choose a tag to compare
@github-actions github-actions released this 08 Dec 10:44
· 804 commits to main since this release

0.9.12 (2021-12-08)

Bug Fixes

  • open in codesandbox button: optimize for long sandoxes (#120) (3ad5261)

This introduces a breaking change due to useCodeSandboxLink is no longer used to generate the URL. From now on, the UnstyledOpenInCodeSandboxButton is responsible for managing the URL or the form that will create a new sandbox in the CodeSandbox.

In the previous approach, all the parameters to create a sandbox in the CodeSandbox were attached directly in the URL, making it easily reach the request too long (401). That's why we deprecated the hook in favor of using a whole new component, which is responsible for either using an anchor (for short sandboxes) or a form-POST (for long sandboxes).

The UnstyledOpenInCodeSandboxButton is a basic component that doesn't carry any style, so if you want a ready-to-use component, use the OpenInCodeSandboxButton instead, which contains the CodeSandbox logo and the same functionality.


Migration guide:

import {
--  useCodeSandboxLink,
++  UnstyledOpenInCodeSandboxButton
}
const CustomOpenInCSB = () => {
--  const url = useCodeSandboxLink();
--  return <a href={url}>Open in CodeSandbox</a>
++  return <UnstyledOpenInCodeSandboxButton>pen in CodeSandbox</UnstyledOpenInCodeSandboxButton>
   );
};