• 
      

    Only register action JS models if the action is being rendered.

    Review Request #14800 — Created Feb. 5, 2026 and submitted — Latest diff uploaded

    Information

    Review Board
    release-7.1.x

    Reviewers

    With the new action framework changes that separate out action model
    registration from rendering, we were now registering every single action
    on every page, whether or not they were being used. This meant that any
    user would end up seeing actions for other pages, including the admin
    page, which certainly wouldn't be correct. While there are cases where
    an action may be worth registering when not rendered, in most cases we
    want to avoid this behavior.

    This change tackles this in two ways:

    1. All rendered action IDs are tracked in the PageState, making it
      easy to determine which actions have been placed on the page in some
      way.

    2. A new BaseAction.should_register() has been added that returns
      whether registration of the model should take place. By default,
      this will only return True if the action has been rendered (which
      has the benefit of inheriting the result of should_render()).
      Subclasses can override this to always register, or to limit to
      certain URLs or other criteria (but should always respect
      should_render()).

    With this, actions are now only registered on the pages in which they're
    used, by default, without limiting more advanced use cases.

    Unit tests pass.

    Verified that admin actions weren't showing up on other pages, but were
    showing up in the admin UI.

    Commits

    Files