Skip to content

Commit

Permalink
fix: no lcp target text from missing element
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney committed Apr 22, 2024
1 parent a1babb4 commit c7ae5ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ sampleRUM.drain('cwv', (() => {
if (measurement.name === 'LCP' && measurement.entries.length > 0) {
const { element } = measurement.entries.pop();
data.target = sampleRUM.targetselector(element);
data.source = sampleRUM.sourceselector(element) || element.outerHTML.slice(0, 30);
data.source = sampleRUM.sourceselector(element) || element?.outerHTML.slice(0, 30);
}

sampleRUM('cwv', data);
Expand Down

0 comments on commit c7ae5ea

Please sign in to comment.