perf: preload the ops module graph

Admin assets are no-store, so every load refetches all of them, and es module
imports are discovered one level at a time: main parses, then its imports are
found, then theirs. Preload hints turn that waterfall into one parallel burst.
The hrefs deliberately carry no version query because they have to byte-match
what the import specifiers resolve to, otherwise the browser fetches each module
twice instead of reusing the preload.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnNxwxfXSbeNtjvtz5gayb
This commit is contained in:
ImBenji
2026-09-01 20:26:43 +01:00
co-authored by Claude Opus 5
parent 93108a27fe
commit 40f098129c
+12 -1
View File
@@ -6,6 +6,17 @@
<title>Duriin Ops</title>
<link rel="stylesheet" href="/admin/assets/css/ops.css?v=20260901-1">
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
<!-- Admin assets are served no-store so an operator can never run stale UI against
a fresh api. That means every module is refetched every load, and left alone
they arrive in a waterfall: main is parsed, then its imports are discovered,
then theirs. Preloading flattens that into one parallel burst. -->
<link rel="modulepreload" href="/admin/assets/js/ops/core.js">
<link rel="modulepreload" href="/admin/assets/js/ops/ui.js">
<link rel="modulepreload" href="/admin/assets/js/ops/overview.js">
<link rel="modulepreload" href="/admin/assets/js/ops/controls.js">
<link rel="modulepreload" href="/admin/assets/js/ops/explore.js">
<link rel="modulepreload" href="/admin/assets/js/ops/sql.js">
</head>
<body>
<div id="root">
@@ -22,6 +33,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.3.1/umd/react.production.min.js" crossorigin></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.3.1/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/htm/3.1.1/htm.js" crossorigin></script>
<script type="module" src="/admin/assets/js/ops/main.js?v=20260901-1"></script>
<script type="module" src="/admin/assets/js/ops/main.js"></script>
</body>
</html>