Skip to content

fix: declare state properties read outside render() - #47

Open
paodb wants to merge 1 commit into
masterfrom
fix/declare-element-properties
Open

paodb wants to merge 1 commit into
masterfrom
fix/declare-element-properties

Conversation

@paodb

@paodb paodb commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Declare circularCrop, outputMimeType and outputQuality on ImageCropElement so image-crop.tsx type-checks under strict. They're defined at runtime by useState() and read via this. outside render(); declare emits no class field, so runtime behavior is unchanged.

Close #45

Summary by CodeRabbit

  • Bug Fixes
    • Image cropping now correctly preserves circular-crop settings and configured output format and quality.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ImageCropElement now declares three hook-managed state properties without emitting class fields at runtime.

Changes

Image crop state declarations

Layer / File(s) Summary
Hook-managed property declarations
src/main/resources/META-INF/frontend/src/image-crop.tsx
ImageCropElement declares circularCrop, outputMimeType, and outputQuality without creating runtime class fields.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: scardanzan

Merge Risk: Minimal · up to 52aaa

This adds type declarations only and does not change runtime behavior. Merge risk is minimal.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #45 requires that the source in image-crop.tsx compile. The PR adds declare statements for circularCrop, outputMimeType, and outputQuality on ImageCropElement (verified at reviewed hea… Provide the result of a TypeScript type-check of src/main/resources/META-INF/frontend/src/image-crop.tsx under strict at the reviewed head, showing no error TS2769 for the makeAspectCrop call. Alternatively, provide the build output f…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: declare state properties read outside render()" matches the changeset. The PR adds TypeScript declare properties for circularCrop, outputMimeType, and outputQuality on ImageCropEleme…
Out of Scope Changes check Passed The PR summary reports +8/-0 lines in image-crop.tsx. The added lines match the declare block with its explanatory comment and the three property declarations (verified at reviewed head). These li…
Full details: Title check

Explanation

The title "fix: declare state properties read outside render()" matches the changeset. The PR adds TypeScript declare properties for circularCrop, outputMimeType, and outputQuality on ImageCropElement in image-crop.tsx, so the type checker accepts reads of state values outside render() without emitting class fields that could shadow hooks.useState() values. The title names the main change and follows a conventional commit style. It does not mention the strict type-checking motivation, which is an acceptable omission.

Full details: Out of Scope Changes check

Explanation

The PR summary reports +8/-0 lines in image-crop.tsx. The added lines match the declare block with its explanatory comment and the three property declarations (verified at reviewed head). These lines directly implement the strict type-checking objective of #45. No unrelated change is identified in the evidence available. The whole-PR diff blob was unavailable, so the base comparison relies on the PR summary and the head file content.

Full details: Linked Issues check

Explanation

Issue #45 requires that the source in image-crop.tsx compile. The PR adds declare statements for circularCrop, outputMimeType, and outputQuality on ImageCropElement (verified at reviewed head). Static reading of the head file also shows the makeAspectCrop call in applyAspect passes a literal { unit: "%", ... } object, which matches the overload quoted in the issue. The issue itself states this was not compiled. The PR description does not report a build or type-check result. No compile or test evidence is available, and the whole-PR diff blob could not be read, so compliance with the strict type-check requirement cannot be confirmed.

Resolution

Provide the result of a TypeScript type-check of src/main/resources/META-INF/frontend/src/image-crop.tsx under strict at the reviewed head, showing no error TS2769 for the makeAspectCrop call. Alternatively, provide the build output for the project's frontend compilation.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 87172be5-50cc-426e-b3f2-27e1c2b37d54
Commits

Reviewing files that changed from the base of the PR and between 73551f5 and 52aaa21.

Files selected for processing: 1

  • src/main/resources/META-INF/frontend/src/image-crop.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

@paodb
paodb marked this pull request as ready for review November 16, 2026 19:50
@paodb
paodb requested a review from scardanzan November 16, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Do

Development

Successfully merging this pull request may close these issues.

Type error in image-crop.tsx

1 participant