Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smart-mails-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@playcanvas/react": patch
---

Prevents deprecation warnings flooding the console during prop validation
8 changes: 8 additions & 0 deletions packages/lib/src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ export function getPseudoPublicProps(container: Record<string, unknown>): Record

// If it's a getter/setter property, try to get the value
if (descriptor.get) {
const originalWarn = console.warn;
try {
// Temporarily silence the console
console.warn = () => {};

const value = descriptor.get.call(container);
// Create a shallow copy of the value to avoid reference issues
const safeValue = value !== null && typeof value === 'object'
Expand All @@ -300,6 +304,10 @@ export function getPseudoPublicProps(container: Record<string, unknown>): Record
isDefinedWithSetter: hasSetter
};
}
finally {
// Restore the console
console.warn = originalWarn;
}
} else if (hasSetter) {
// Setter-only property
result[key] = {
Expand Down
Loading