Handle soft deleted purchasable on order lines#2302
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds a null-check when generating the description URL in OrderItemsTable to ensure purchasable exists before accessing its product_id, avoiding null dereference and skipping URL resolution when absent. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)packages/admin/src/Filament/Resources/OrderResource/Pages/Components/OrderItemsTable.php (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
🔇 Additional comments (1)
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where viewing orders in the admin panel would throw exceptions when order lines reference soft-deleted products. The fix adds a null check for the purchasable relation before attempting to generate product links.
- Adds null safety check for
purchasablerelation before accessing its properties - Prevents exceptions when generating product links for soft-deleted purchasables
- Ensures order pages remain accessible even with deleted product references
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Currently when viewing an order in the panel a link is provided to the product, however if this product has been soft deleted then an exception is thrown due to trying to get the
productto provide a link.This is a small PR which will check for the existence of the
purchasablerelation before attempting to generate the link to ensure the page will still load in the event the product has been deleted.Summary by CodeRabbit