Add a review UI attribute for skipping static media when rendered inline.
Review Request #14626 — Created Oct. 1, 2025 and updated
Now that we allow document review UIs in the diff viewer, we've been
having to deal with the possibility of extension static media being
loaded multiple times from different sources onto a page. Currently,
both extensions and review UIs can load static media onto a page. It's
possible that an extension loads static media onto the diff viewer page, and
that the extension has a review UI that loads the same static media onto
the page, resulting in duplicate loads. At best this is redundant and
costly, and at worst this can break things if the static media sets
state that needs to be shared among the extension and any review UIs.
The latter is the case for Power Pack's document review.This change adds a
ReviewUI.load_static_media_inline
class variable
that lets review UIs indicate whether to load static media when the
review UI is rendered inline. If the extension managing the review UI
already loads its static media in the diff viewer page or any other page
where a Review UI might be rendered, then this can be set toFalse
to prevent duplicate loading. This change also improves some of the
review UI documentation. When I land this change I'll take care to merge
the changes with the review UI doc improvements in /r/14542/.We did explore more general solutions to handle duplicate static media loads
at the extension or page level, which would be useful if we ever have more
things that can load static media, but couldn't work out a good solution.
Since extensions and review UIs are the only things in Review Board that
deal with loading static media, this fix is sufficient for now.
- Built and checked the docs.
- Used with a change in Power Pack that solves problems from
duplicate static media loads.
Summary | ID |
---|---|
9fca3dfb69e8a033c20d95d6ffdf46cf9a2e0d7f |