The README makes an explicit SSR promise:
The component works out of the box in React Server Components environments (e.g. Next.js App Router) — it ships with the 'use client' directive and touches the DOM only inside effects.
That claim is backed by a tsup banner:
https://github.com/unlayer/react-image-editor/blob/628b507/tsup.config.ts#L11-L14
…but nothing verifies it. The whole suite runs in jsdom (vitest.config.ts), so every test renders client-side. There is no test that:
- the built
dist/index.js and dist/index.mjs actually start with 'use client' — a banner is a build-config detail that a bundler or config change could silently drop, and it wouldn't fail any current check;
- the component renders without throwing under
react-dom/server's renderToString — i.e. that the render path really does stay off the DOM until effects run.
Both are cheap:
// dist smoke test
expect(readFileSync('dist/index.mjs', 'utf8').startsWith("'use client';")).toBe(true);
// SSR smoke test (node environment)
expect(() => renderToString(<ImageEditor image="x" />)).not.toThrow();
The second needs a // @vitest-environment node file (or a second Vitest project) since the current global environment is jsdom. The first needs to run after npm run build, so it fits as a post-build step in the CI checks job.
Given that Next.js App Router is called out by name as a supported target, it's worth having the regression net.
The README makes an explicit SSR promise:
That claim is backed by a
tsupbanner:https://github.com/unlayer/react-image-editor/blob/628b507/tsup.config.ts#L11-L14
…but nothing verifies it. The whole suite runs in
jsdom(vitest.config.ts), so every test renders client-side. There is no test that:dist/index.jsanddist/index.mjsactually start with'use client'— a banner is a build-config detail that a bundler or config change could silently drop, and it wouldn't fail any current check;react-dom/server'srenderToString— i.e. that the render path really does stay off the DOM until effects run.Both are cheap:
The second needs a
// @vitest-environment nodefile (or a second Vitest project) since the current global environment isjsdom. The first needs to run afternpm run build, so it fits as a post-build step in the CIchecksjob.Given that Next.js App Router is called out by name as a supported target, it's worth having the regression net.