Comments (6)
I noticed this today too, did earlier versions of the API only support one script
element, perhaps?
test/test-prerender-only.html can be used to reproduce the issue. Note how in the screenshot below, only 1.html
will be prerendered:
from quicklink.
did earlier versions of the API only support one script element, perhaps?
Yes that's correct. It's a relatively recent change (Chrome 107 I think) that allowed multiple prerenders.
from quicklink.
I've had a look around the repo and made a few changes locally. I think there are a few things we will need to do:
- Remove
isSpecRulesExists()
function definition and usage - Remove
prerenderLimit
const definition - Remove
if (toPrerender.size < prerenderLimit) {
check - Add
toPrerender.clear();
to the 'reset' function returned fromlisten()
(toPrefetch.clear();
is there already) - Call
toPrerender.clear();
after adding the Speculation Rulesscript
elements to prevent a build up of the same URLs being included as new links are found on scroll (see example below), maybe add a mechanism to avoid adding a URL twice if ascript
element is created for it once, then again when the user scrolls back to that part of the page? - Remove or update comments prerendering conditions comments now that '2)' has been removed:
Lines 239 to 258 in e6565ed
Example of not clearing out the toPrerender
set:
<script type="speculationrules">
{ "prerender": [{ "source": "list", "urls": ["http://localhost:8080/work"] }] }
</script>
<script type="speculationrules">
{ "prerender": [{ "source": "list", "urls": ["http://localhost:8080/work", "http://localhost:8080/contact"] }] }
</script>
<script type="speculationrules">
{ "prerender": [{ "source": "list", "urls": ["http://localhost:8080/work", "http://localhost:8080/contact", "http://localhost:8080/github-stars"] }] }
</script>
<script type="speculationrules">
{ "prerender": [{ "source": "list", "urls": ["http://localhost:8080/work", "http://localhost:8080/contact", "http://localhost:8080/github-stars", "http://localhost:8080/github-stars?no-js"] }] }
</script>
from quicklink.
All that said, I did quite quickly start seeing Max number of prerendering exceeded
/MaxNumOfRunningPrerendersExceeded
messages in the experimental Prerender2
dev tools panel, so I'm thinking that Quicklink's approach of prerendering anything in the viewport might be a bit too resource intensive compared to only prerendering links that are being hovered over or touchstart
'ed on.
from quicklink.
Yeah there's current a limit of 10 prerenders. IMHO that is more than enough, and prerendering even that many (which I could easily see happening if prerendering all in-viewport links) seems like a lot to me.
from quicklink.
quicklink
export prerender
API, currently, if call prerender
multiple times, still throw this error. If user use prerender
API manual, I think we should not limit prerender urls size.
Maybe should mv isSpecRulesExists
check function into listen
. 🤔
from quicklink.
Related Issues (20)
- Unrelated Issue, please delete this.
- minConnectionType option
- Switch from mocha to uvu
- site: add SRI hashes for CDN links
- el option not working as it should HOT 1
- Fix Prerender Support HOT 4
- site: add missing `alt` attributes HOT 3
- Mark peerDependencies as optional
- site: use unique page descriptions HOT 1
- infra: Redirect www domain to root
- Document the modern bundle
- No prefetching occurs for duplicate links
- site: use the files from dist folder instead of the CDN HOT 2
- Prerendering is not working HOT 5
- withQuicklink can't not support typescript HOT 1
- Avoid Triggering Requests while offline
- quicklink.prefetch need add option crossorigin attr,support prefetch cross origin resources
- Quicklink causes desynchronizations between pages for users login and cart counter
- Update request for "quicklink" library to fix CORS errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quicklink.