-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(delegate): null reference when reading an optional relation #1491
Conversation
WalkthroughWalkthroughThe recent changes address an issue where optional relations in polymorphic models caused errors during database operations. The Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant DelegateProxyHandler
participant Database
User->>DelegateProxyHandler: Call assembleUp(entity)
alt entity is falsy
DelegateProxyHandler-->>User: Return entity
else entity exists
DelegateProxyHandler->>Database: Process entity
Database-->>DelegateProxyHandler: Return processed data
DelegateProxyHandler-->>User: Return processed data
end
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/runtime/src/enhancements/delegate.ts (1)
Line range hint
309-309
: Consider replacing the delete operator with setting properties to undefined for better performance.- delete obj.property; + obj.property = undefined;Also applies to: 332-332, 709-709, 772-772, 780-780
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/runtime/src/enhancements/delegate.ts (2 hunks)
- tests/regression/tests/issue-1483.test.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- tests/regression/tests/issue-1483.test.ts
Additional context used
Biome
packages/runtime/src/enhancements/delegate.ts
[error] 309-309: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 332-332: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 709-709: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 772-772: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 780-780: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
Additional comments not posted (2)
packages/runtime/src/enhancements/delegate.ts (2)
1104-1106
: LGTM! The early return for falsy entities inassembleUp
should prevent null reference errors as intended.
1155-1157
: LGTM! The early return for falsy entities inassembleDown
should prevent null reference errors as intended.
Fixes #1483