Skip to content

Conversation

@marklundin
Copy link
Collaborator

@marklundin marklundin commented Sep 11, 2025

Fixes an issue with prop validation where members only have a setter.

…application

- Updated the component removal logic to ensure that a component is only removed if it exists on the parent.
- Added error handling when applying properties to instances to log any issues encountered during the process.
- Modified the focus method call to include a boolean parameter for better control over camera behavior during animations.
@changeset-bot
Copy link

changeset-bot bot commented Sep 11, 2025

🦋 Changeset detected

Latest commit: e6a820a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@playcanvas/react Patch
@playcanvas/blocks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@playcanvas/blocks@241
npm i https://pkg.pr.new/@playcanvas/react@241

commit: e6a820a

@marklundin marklundin self-assigned this Sep 11, 2025
@marklundin marklundin requested a review from Copilot September 11, 2025 18:18
@marklundin marklundin added React bug Something isn't working labels Sep 11, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue with prop validation for components that have only getters without setters. The fix includes error handling for property assignment failures and adjusts the logic for determining which properties should be included in pseudo-public props.

  • Adds try-catch error handling around property assignment to prevent crashes when setting read-only properties
  • Updates prop filtering logic to include properties with getters but exclude setter-only properties
  • Adds a safety check to prevent unnecessary component removal operations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/lib/src/utils/validation.ts Adds error handling for property assignment and fixes prop filtering logic for getter/setter properties
packages/lib/src/hooks/use-component.tsx Adds safety check to prevent component removal when component doesn't exist
.changeset/thirty-yaks-occur.md Documents the prop validation improvement as a patch release

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@marklundin marklundin marked this pull request as ready for review September 11, 2025 18:32
@marklundin marklundin merged commit 6372f9c into main Sep 11, 2025
6 checks passed
@marklundin marklundin deleted the fix-prop-validation branch September 11, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working React

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants