fix(sdk): use after interactive for nextjs #290

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-02-17 13:48:03 +01:00
parent fef4941e06
commit 5a0769c917

View File

@@ -22,6 +22,7 @@ type OpenPanelComponentProps = Omit<OpenPanelOptions, 'filter'> & {
cdnUrl?: string;
filter?: string;
globalProperties?: Record<string, unknown>;
strategy?: 'beforeInteractive' | 'afterInteractive' | 'lazyOnload' | 'worker';
};
const stringify = (obj: unknown) => {
@@ -42,6 +43,7 @@ export function OpenPanelComponent({
profileId,
cdnUrl,
globalProperties,
strategy = 'afterInteractive',
...options
}: OpenPanelComponentProps) {
const methods: { name: OpenPanelMethodNames; value: unknown }[] = [
@@ -80,7 +82,8 @@ export function OpenPanelComponent({
<>
<Script src={appendVersion(cdnUrl || CDN_URL)} async defer />
<Script
strategy="beforeInteractive"
id="openpanel-init"
strategy={strategy}
dangerouslySetInnerHTML={{
__html: `${getInitSnippet()}
${methods