perf: preconnect + preload Slise embed so ad banners render as the pa…#686
Merged
liangping merged 1 commit intoJul 8, 2026
Merged
Conversation
…ge loads Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
|
@devmildfire Thanks for PR, it's better now, but there still a delayed refresh during page switching. you can take a look. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
perf: preconnect + preload Slise embed so ad banners render as the page loads
Problem
The Slise ad banner stays blank for roughly a second after the page loads. The
embed script is only injected inside
AdBanner'sonMounted— after the appbundle downloads, parses, and mounts the ad component — and it's requested over
a cold connection with no resource hints, so nothing about the ad load overlaps
the app boot.
Changes
index.html—preconnect/dns-prefetchthe Slise origin andpreloadembed.js, so the ~21 KB script downloads in parallel with the app bundleinstead of ~1 s later.
embed.jsis already allow-listed in the existing CSP,so no CSP change is needed, and the script still only executes when an
AdBannermounts — the preload just makes the bytes ready in advance.AdBanner.vue— fill the slot on the script'sloadevent instead of aone-shot
typeof window.adsbyslisesync === 'function'check. On the firstbanner that function isn't defined yet (the async script is still loading), so
the previous code silently skipped the sync and the first ad only filled once
Slise's script finished and ran its own auto-sync. Waiting for
loadfills thefirst banner the moment the script is ready.
Result
Measured on a local build:
embed.js's request start moves from ~1013 ms to~14 ms after navigation (now fetched by the preload), so the banner creative
can paint about a second sooner.
yarn build(type-check + build) passes; thediff is two files with no dependency or API changes.