fix: prevent double registration when a Page is in both registration_…#59
Merged
fix: prevent double registration when a Page is in both registration_…#59
Conversation
…classes and a Group (issue #58) Page_Dispatcher now tracks page classes claimed by an Abstract_Group via mark_group_claimed(). Page_Middleware marks every page on a Group during process(), and register_single_page / register_subpage short-circuit when the page class is claimed and the call is not driven by the Group itself. Adds unit tests for the claim methods and the skip behaviour, and an application-level regression test covering primary, sub-page, full-group duplication, no-overlap backward compatibility, and the render-once symptom from the issue.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #59 +/- ##
============================================
+ Coverage 99.29% 99.39% +0.10%
- Complexity 96 119 +23
============================================
Files 12 13 +1
Lines 282 330 +48
============================================
+ Hits 280 328 +48
Misses 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…-page-registration
…ry + GROUPS_PROCESSED hook Moves the page-claim storage out of Page_Dispatcher's private array into a new Group_Page_Registry service that is registered as shared in Admin_Menu::pre_boot. Page_Dispatcher resolves it lazily from the DI container, so dispatcher and any downstream consumer see the same instance. Page_Middleware no longer holds the claim helper itself; it delegates to Page_Dispatcher::record_group_pages() during process(), and fires Hooks::GROUPS_PROCESSED in tear_down() with the populated registry as payload. Downstream modules (e.g. Settings_Page) subscribe in pre_register to react to Group-declared pages and add their own DI rules — order- independent, no priority coordination, no framework changes. The skip-when-claimed behaviour from issue #58 is preserved unchanged; only the storage location moves. Existing application regression tests pass without modification. Adds: Group_Page_Registry + tests, Hooks::GROUPS_PROCESSED + tests, hook firing in Page_Middleware::tear_down + tests, application test for the hook publishing the populated registry, docs/group.md hooks section, README changelog entry for 2.1.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…classes and a Group (issue #58)
Page_Dispatcher now tracks page classes claimed by an Abstract_Group via mark_group_claimed(). Page_Middleware marks every page on a Group during process(), and register_single_page / register_subpage short-circuit when the page class is claimed and the call is not driven by the Group itself.
Adds unit tests for the claim methods and the skip behaviour, and an application-level regression test covering primary, sub-page, full-group duplication, no-overlap backward compatibility, and the render-once symptom from the issue.