-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
When deleting a product, all orders dealing with that product show an error 500 #3903
Comments
On French production (v1) this is working. The product is still shown in the order, even it was deleted. |
Root causeI finally found out that the root cause of the issue is the soft-delete implementation on variant. When fetching data from DB to render the view, among others, we perform a
obviously the result set won't contain the variant of the deleted product and thus in the method below adds a def to_package
package = Spree::Config.package_factory.new(stock_location, order)
inventory_units.includes(:variant).each do |inventory_unit|
package.add inventory_unit.variant, 1, inventory_unit.state_name
end
package
end As a result, the following gets raised
Similar errors will pop up wherever we display variants of a deleted product like in ParanoiaThat Sof-deletable variants have been introduced in v2 so I wonder how we managed in v1 to delete products but still list their variants in the order details. On the other hand, what I don't understand is how could this work in Spree itself. How didn't they handle this scenario of they implemented this feature? I'll see if I can find a fix somewhere in their git history. |
It's also worth checking https://github.com/rubysherpas/paranoia#about-indexes |
Isn't that information in the line items...? |
which one you mean @Matt-Yorkley ? we always have to fetch the variant as well because of the definition of line items: |
🎉 |
This successfully closes openfoodfoundation#3903 by bringing in the changes done in openfoodfoundation/spree#41.
Description
When I delete a product, I cannot see orders that were dealing with this product anymore. Even if those orders contained other products as well
Steps to Reproduce
Bugsnag details on Katuma staging (the order contain only this product):
https://app.bugsnag.com/katuma/katuma/errors/5cf942f2d45903001a72f17f?event_id=5cf942f20041e9c719f30000&i=sk&m=nw
On Katuma production (the order contained other products):
https://app.bugsnag.com/katuma/katuma/errors/5cf8e37a020d19001a50ffda?event_id=5cf8e37a0041e1a0a46c0000&i=sk&m=nw
Animated Gif/Screenshot
Severity
bug-s3: a feature is broken but there is a workaround
Your Environment
The text was updated successfully, but these errors were encountered: