vomebook commited on
Commit
5a249cb
·
1 Parent(s): 8f138db

perf(search): defer reader assets from first paint

Browse files
static/index.html CHANGED
@@ -31,7 +31,6 @@
31
  <link rel="icon" type="image/png" sizes="512x512" href="/icons/icon-512.png">
32
  <link rel="icon" type="image/svg+xml" href="/icons/icon.svg">
33
  <script>fetch("/api/ping", { cache: "no-store" }).catch(() => {});</script>
34
- <link rel="preload" href="/api/reader-assets" as="fetch" crossorigin="anonymous">
35
  <link rel="stylesheet" href="/static/style.css">
36
  </head>
37
  <body class="dark">
 
31
  <link rel="icon" type="image/png" sizes="512x512" href="/icons/icon-512.png">
32
  <link rel="icon" type="image/svg+xml" href="/icons/icon.svg">
33
  <script>fetch("/api/ping", { cache: "no-store" }).catch(() => {});</script>
 
34
  <link rel="stylesheet" href="/static/style.css">
35
  </head>
36
  <body class="dark">
tests/test_static_contract.py CHANGED
@@ -225,6 +225,7 @@ class StaticFrontendContractTests(unittest.TestCase):
225
  self.assertIn("PDF_MANIFEST_INVALID", reader)
226
  self.assertIn("page-[0-9]{6}", contract)
227
  self.assertIn('fetchJsonWithTimeout("/api/reader-assets", 10000)', self.js)
 
228
  self.assertIn('.catch(() => ({}))', self.js)
229
  self.assertIn("applyReaderAsset", self.js)
230
  self.assertIn('function getReaderLink(rec, returnUrl = location.href, cacheMetadata = true)', self.js)
 
225
  self.assertIn("PDF_MANIFEST_INVALID", reader)
226
  self.assertIn("page-[0-9]{6}", contract)
227
  self.assertIn('fetchJsonWithTimeout("/api/reader-assets", 10000)', self.js)
228
+ self.assertNotIn('rel="preload" href="/api/reader-assets"', self.html)
229
  self.assertIn('.catch(() => ({}))', self.js)
230
  self.assertIn("applyReaderAsset", self.js)
231
  self.assertIn('function getReaderLink(rec, returnUrl = location.href, cacheMetadata = true)', self.js)