Refactor default.js
What does this MR do and why?
Refactors default.js, which had gotten a little unorganized as we've added more site-wide Vue components. This file is used to load components and functions that are used on all standard content pages.
Changes:
- Removes the Archives page component from default.js. It does not need to load site-wide; we can load it solely on the archives page.
- Removes extra event listeners on
DOMContentLoaded
. Mounting the various components can happen within a single event listener. - Removes Vue library imports from individual components in favor of a globally-included Vue import and assignment to the window scope in default.js. We were previously loading Vue itself twice on the deprecations and archives pages (which wasn't as heavy as you might think, but still... oops).
This MR may provide minor frontend performance improvements as it should reduce bundle size on some pages, but the intent here is mostly to make this code more readable and extendable without unnecessary repetition. I'd started to include these changes in work for #1515 (closed), but it got a little far-reaching, so I figured a separate refactor MR like this would be easier to review.
Screenshots, screen recordings, or links to review app
No visual changes expected.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md. -
Verify components referenced in this MR still load without errors:
- Archives page: https://default-js-refactor.docs.gitlab-review.app/archives/ (the list of offline versions is Vue-driven)
- Global nav toggle (expand/collapse global nav at small width)
- Table of contents (right-side nav on standard content pages)
- Filters on the deprecations page
- Tabs (example 1, example 2)
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.