Skip to content

Commit 0dde707

Browse files
committed
Lazy load iframely script
1 parent 128ad20 commit 0dde707

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/polite-spies-beg.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gitbook': patch
3+
---
4+
5+
Lazy load iframely script to make page more responsive

packages/gitbook/src/components/DocumentView/Embed.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as gitbookAPI from '@gitbook/api';
2-
import { headers } from 'next/headers';
32
import Script from 'next/script';
43
import ReactDOM from 'react-dom';
54

@@ -32,7 +31,11 @@ export async function Embed(props: BlockProps<gitbookAPI.DocumentBlockEmbed>) {
3231
}}
3332
data-visual-test="blackout"
3433
/>
35-
<Script src="https://cdn.iframe.ly/embed.js" nonce={nonce} />
34+
<Script
35+
strategy="lazyOnload"
36+
src="https://cdn.iframe.ly/embed.js"
37+
nonce={nonce}
38+
/>
3639
</>
3740
) : embed.type === 'integration' ? (
3841
<IntegrationBlock

0 commit comments

Comments
 (0)