Skip to content
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

[WIP] Use zeitwerk on load instead of hooking descendants subclasses #22945

Commits on Mar 18, 2024

  1. Replace descendants/subclasses hooks with Zeitwerk on_load

    We're now eager loading subclasses when loading the parent but this is far
    less reliant on hacks and closer to full eager loading, which is what rails has
    been pushing us to do for years.  Let's try it out.
    
    Rails changed in 7.0 to call subclasses from reload_schema_from_cache here:
    rails/rails@6f30cc0
    
    It also changed to call descendants on the callback class (self) insead of
    the ActiveSupport::DescendantsTracker here:
    rails/rails@ffae3bd
    
    We are not expecting to be called from these locations.
    
    Avoiding descendants / subclasses calls in conditionals like this are just brittle
    so we need to stop hooking through these methods:
    if !%w[reload_schema_from_cache __update_callbacks descendants subclasses].include?(caller_locations.first.base_label)
    jrafanie committed Mar 18, 2024
    Configuration menu
    Copy the full SHA
    cdb773d View commit details
    Browse the repository at this point in the history

Commits on Mar 19, 2024

  1. Configuration menu
    Copy the full SHA
    f0715ae View commit details
    Browse the repository at this point in the history