Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRASH FIX- resolve origin domain data crash when FID undefined #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ const getFieldData = async () => {
);

// Otherwise Extract Origin Field metrics (if there are)
const fieldFCP = fieldMetrics.FIRST_CONTENTFUL_PAINT_MS.percentile;
const fieldFID = fieldMetrics.FIRST_INPUT_DELAY_MS.percentile;
const fieldLCP = fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS.percentile;
const fieldCLS = fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile;
const fieldFCP = fieldMetrics.FIRST_CONTENTFUL_PAINT_MS ? fieldMetrics.FIRST_CONTENTFUL_PAINT_MS.percentile : "FIRST_CONTENTFUL_PAINT_MS undefined";
const fieldFID = fieldMetrics.FIRST_INPUT_DELAY_MS ? fieldMetrics.FIRST_INPUT_DELAY_MS.percentile : "FIRST_INPUT_DELAY_MS undefined";
const fieldLCP = fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS ? fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS.percentile : "LARGEST_CONTENTFUL_PAINT_MS undefined";
const fieldCLS = fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE ? fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile : "CUMULATIVE_LAYOUT_SHIFT_SCORE undefined";

// Construct fieldResult object
const fieldResObj = {
Expand Down
11 changes: 4 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,10 @@ const getSpeedData = async (testNum = 1) => {
);

// Otherwise Extract Origin Field metrics (if there are)
const fieldFCP =
fieldMetrics.FIRST_CONTENTFUL_PAINT_MS.percentile;
const fieldFID = fieldMetrics.FIRST_INPUT_DELAY_MS.percentile;
const fieldLCP =
fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS.percentile;
const fieldCLS =
fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile;
const fieldFCP = fieldMetrics.FIRST_CONTENTFUL_PAINT_MS ? fieldMetrics.FIRST_CONTENTFUL_PAINT_MS.percentile : "FIRST_CONTENTFUL_PAINT_MS undefined";
const fieldFID = fieldMetrics.FIRST_INPUT_DELAY_MS ? fieldMetrics.FIRST_INPUT_DELAY_MS.percentile : "FIRST_INPUT_DELAY_MS undefined";
const fieldLCP = fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS ? fieldMetrics.LARGEST_CONTENTFUL_PAINT_MS.percentile : "LARGEST_CONTENTFUL_PAINT_MS undefined";
const fieldCLS = fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE ? fieldMetrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile : "CUMULATIVE_LAYOUT_SHIFT_SCORE undefined";

// Construct fieldResult object
const fieldResObj = {
Expand Down