You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom defined event subscriber modules may end up being subscribed twice (or more!) on Solidus apps based on Rails 6.x. I was not able to reproduce this issue on Rails 5.2.
The problem happens only in development (or more generally when classes are not cached) and when event subscribers are loaded using initializers, as we used to suggest in the Event section of Solidus documentation.
Apparently, the issue is related to the new Zeitwerk autoload.
The simplest fix for this is to simply remove the offending initializers. Subscribers will be loaded automatically anyways thanks to #3571.
If for any reason somebody does not want to remove the initializers or wants to experiment with the issue, by explicitly requiring the subscriber file in the initializer will fix it:
Solidus Version:
master
Description
Custom defined event subscriber modules may end up being subscribed twice (or more!) on Solidus apps based on Rails 6.x. I was not able to reproduce this issue on Rails 5.2.
The problem happens only in development (or more generally when classes are not cached) and when event subscribers are loaded using initializers, as we used to suggest in the Event section of Solidus documentation.
Apparently, the issue is related to the new Zeitwerk autoload.
The simplest fix for this is to simply remove the offending initializers. Subscribers will be loaded automatically anyways thanks to #3571.
If for any reason somebody does not want to remove the initializers or wants to experiment with the issue, by explicitly requiring the subscriber file in the initializer will fix it:
I'm working on a more robust solution (a centralized way to track event subscribers subscriptions) that will completely remove the issue.
The text was updated successfully, but these errors were encountered: