Skip to content

Fix circular autoload in decorate_form_with_adapter_logic #407

Merged
ShanaLMoore merged 1 commit into
mainfrom
fix/skip-form-decoration-in-flexible-mode
Mar 6, 2026
Merged

Fix circular autoload in decorate_form_with_adapter_logic #407
ShanaLMoore merged 1 commit into
mainfrom
fix/skip-form-decoration-in-flexible-mode

Conversation

@ShanaLMoore

@ShanaLMoore ShanaLMoore commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

In Hyrax flexible metadata mode, Hyrax::FormFields(:child_works_from_pdf_splitting) is a no-op, but the unconditional "#{work_type}Form".constantize call was triggering a circular autoload error when a model was loaded before its form. Guard the entire method with an early return when Hyrax.config.flexible? is true.

This removes the need for the monkey-patch that knapsack apps (e.g. hykuup_knapsack) had to apply via a local initializer (refs notch8/hykuup_knapsack#630).

Issue:

…flexible mode is enabled

In Hyrax flexible metadata mode, `Hyrax::FormFields(:child_works_from_pdf_splitting)`
is a no-op, but the unconditional `"#{work_type}Form".constantize` call was triggering
a circular autoload error when a model was loaded before its form. Guard the entire
method with an early return when `Hyrax.config.flexible?` is true.

This removes the need for the monkey-patch that knapsack apps (e.g. hykuup_knapsack)
had to apply via a local initializer (refs notch8/hykuup_knapsack#630).
@ShanaLMoore ShanaLMoore merged commit 43cf1af into main Mar 6, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants