From 52aaa21a8730e3d2123e00811dbce98c1cc4016c Mon Sep 17 00:00:00 2001 From: Paola De Bartolo Date: Mon, 16 Nov 2026 16:30:00 -0300 Subject: [PATCH] fix: declare state properties read outside render() Close #45 --- src/main/resources/META-INF/frontend/src/image-crop.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/resources/META-INF/frontend/src/image-crop.tsx b/src/main/resources/META-INF/frontend/src/image-crop.tsx index 560b99a..0a4e5be 100644 --- a/src/main/resources/META-INF/frontend/src/image-crop.tsx +++ b/src/main/resources/META-INF/frontend/src/image-crop.tsx @@ -86,6 +86,14 @@ function resolveOutputType(requested: string | null | undefined, src: string | n class ImageCropElement extends ReactAdapterElement { + /* + * State properties defined at runtime by hooks.useState() and read via this.xxx + * outside render(). Declared with "declare" so no class field shadows them. + */ + declare circularCrop: boolean; + declare outputMimeType?: string; + declare outputQuality?: number; + protected render(hooks: RenderHooks): ReactElement> | null { const [crop, setCrop] = hooks.useState("crop");