🎥 Make videos programmatically with React
`@remotion/vercel`: Use sandbox.stop() in main examples, move await using to separate section
Jonny Burger22598e302b22
diff --git a/packages/docs/docs/vercel/create-sandbox.mdx b/packages/docs/docs/vercel/create-sandbox.mdxindex 4470666c4e..5d31357ec9 100644--- a/packages/docs/docs/vercel/create-sandbox.mdx+++ b/packages/docs/docs/vercel/create-sandbox.mdx@@ -24,6 +24,10 @@ const sandbox = await createSandbox({console.log(`${message} (${Math.round(progress * 100)}%)`);},});++// ... use the sandbox++await sandbox.stop();```## Arguments@@ -51,7 +55,21 @@ type CreateSandboxOnProgress = (update: {## Return value-A `VercelSandbox` object (a [`Sandbox`](https://vercel.com/docs/vercel-sandbox/sdk-reference#sandbox-class) with `AsyncDisposable` support). You can use `await using` to automatically clean up the sandbox when it goes out of scope.+A `VercelSandbox` object (a [`Sandbox`](https://vercel.com/docs/vercel-sandbox/sdk-reference#sandbox-class) with `AsyncDisposable` support). Call `sandbox.stop()` when you are done with the sandbox.++## Using `await using`++You can use `await using` to automatically clean up the sandbox when it goes out of scope:++```ts twoslash title="create-snapshot.ts"+// @module: es2022+// @target: es2022+import {createSandbox} from '@remotion/vercel';+// ---cut---+await using sandbox = await createSandbox({+ bundleDir: '.remotion',+});+```## See alsodiff --git a/packages/docs/docs/vercel/restore-snapshot.mdx b/packages/docs/docs/vercel/restore-snapshot.mdxindex f3214bc2b4..147ae6be74 100644--- a/packages/docs/docs/vercel/restore-snapshot.mdx+++ b/packages/docs/docs/vercel/restore-snapshot.mdx@@ -17,9 +17,13 @@ This is the production counterpart to [`createSandbox()`](/docs/vercel/create-sa// @target: es2022import {createSandbox, restoreSnapshot} from '@remotion/vercel';// ---cut----await using sandbox = process.env.VERCEL+const sandbox = process.env.VERCEL? await restoreSnapshot(): await createSandbox({bundleDir: '.remotion'});++// ... use the sandbox++await sandbox.stop();```## Arguments@@ -30,6 +34,20 @@ None.A [`VercelSandbox`](/docs/vercel/types#vercelsandbox) object restored from the cached snapshot. Throws if no snapshot is found.+## Using `await using`++You can use `await using` to automatically clean up the sandbox when it goes out of scope:++```ts twoslash title="route.ts"+// @module: es2022+// @target: es2022+import {createSandbox, restoreSnapshot} from '@remotion/vercel';+// ---cut---+await using sandbox = process.env.VERCEL+ ? await restoreSnapshot()+ : await createSandbox({bundleDir: '.remotion'});+```+## See also- [`createSandbox()`](/docs/vercel/create-sandbox)