Closed stefanprobst closed 4 months ago
issue description: when <NotEditable> is used in a component-block preview component, which also has the use client directive, ~500kb are added to the client bundle.
<NotEditable>
use client
issue reproduction: https://github.com/stefanprobst/issue-keystatic-noteditable-client-component
steps to reproduce:
git clone git@github.com:stefanprobst/issue-keystatic-noteditable-client-component.git
cd issue-keystatic-noteditable-client-component
pnpm install
pnpm run build
Route (app) Size First Load JS ┌ ○ / 7.24 kB 532 kB ├ ○ /_not-found 877 B 84.8 kB ├ ● /[slug] 479 B 526 kB ├ └ /first-post ├ λ /api/keystatic/[...params] 0 B 0 B └ λ /keystatic/[[...params]] 142 B 84.1 kB
context: i was trying to add a figure component-block, and display the image in the figure preview (which requires use client because it uses useState). see here: https://github.com/stefanprobst/issue-keystatic-noteditable-client-component/blob/main/components/component-blocks/figure.preview.tsx
figure
useState
workaround: using a separate client component for the preview image, see: https://github.com/stefanprobst/issue-keystatic-noteditable-client-component/commit/4dd85001caac81f57584de8941172814c4ac3555
no longer an issue.
issue description: when
<NotEditable>
is used in a component-block preview component, which also has theuse client
directive, ~500kb are added to the client bundle.issue reproduction: https://github.com/stefanprobst/issue-keystatic-noteditable-client-component
steps to reproduce:
git clone git@github.com:stefanprobst/issue-keystatic-noteditable-client-component.git
cd issue-keystatic-noteditable-client-component
pnpm install
pnpm run build
context: i was trying to add a
figure
component-block, and display the image in thefigure
preview (which requiresuse client
because it usesuseState
). see here: https://github.com/stefanprobst/issue-keystatic-noteditable-client-component/blob/main/components/component-blocks/figure.preview.tsxworkaround: using a separate client component for the preview image, see: https://github.com/stefanprobst/issue-keystatic-noteditable-client-component/commit/4dd85001caac81f57584de8941172814c4ac3555