Derive the artifact registry document title in the app shell
What does this MR do and why?
This change is behind the feature flag :artifact_registry_ui
router.afterEach(updateDocumentTitle()) pushed the document title on navigation.
It fires once, synchronously, so it can only render what is knowable the instant a
route is entered.
That is enough for every route the artifact registry SPA has today, because each one is named by its own URL segment or by static route meta. It stops being enough as soon as a page is named by something read after the navigation that opened it — which the version list will be, since Artifact Registry addresses an artifact by an opaque id rather than by name.
So the shell derives the title instead of a hook pushing it. This is the shape
explore/analytics_dashboards
already uses, for the same reason — its own comment reads "A router hook would fire
before the asynchronous dashboard name arrives."
No behaviour changes. Every route titles exactly as it did.
Changes
buildDocumentTitlereplacesupdateDocumentTitle: pure, taking the route and the base title, rather than building a hook that assigns.app.vuecaptures the Rails-rendered title as its base, derives the title in a computed, and assigns it from animmediatewatcher.routeNameis extracted so the breadcrumb trail and the document title share one rule and cannot disagree about what a page is called.- The router no longer registers an
afterEach, and no longer imports fromutils. - The title tests move from the router spec to the shell that now owns them, and the repository detail spec drops the title assertion it could only make because a hook was doing the work.
Screenshots or screen recordings
No visible change. The document title and breadcrumb trail render identically on every route.
How to set up and validate locally
- Enable the flag:
Feature.enable(:artifact_registry_ui). - Visit
/o/<organization>/-/artifact_registry/acme/repositories. - Open a repository, then its Edit form.
- Confirm the browser tab title reads as it does on
master:- list →
Repositories · <org> · GitLab - detail →
<repository> · Repositories · <org> · GitLab - edit →
Edit hosted repository · <repository> · Repositories · <org> · GitLab
- list →
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.