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

fix info script so timing script doesn't fail if undefined #7

Merged
merged 2 commits into from
Jul 18, 2022

Conversation

jhadev
Copy link
Collaborator

@jhadev jhadev commented Jul 16, 2022

changed this code to avoid empty arrays without objects with 'name' property

const scripts = {
    firstParty: [{ name: "no data" }],
    thirdParty: [{ name: "no data" }],
  };

  if (first.length) {
    scripts.firstParty = first;
  }

  if (third.length) {
    scripts.thirdParty = third;
  }

return scripts

Tested by running on apple.com which has no third party scripts. Note timing script does not fail.

pic-Google Chrome-Apple-07-152022 2

Previous snippet caused this error on apple.com

pic-Google Chrome-Buy 14-inch MacBook Pro - Apple-07-162022

@jhadev jhadev linked an issue Jul 16, 2022 that may be closed by this pull request
@jhadev jhadev requested a review from nucliweb July 16, 2022 02:50
@jhadev jhadev added the bug Something isn't working label Jul 16, 2022
@jhadev
Copy link
Collaborator Author

jhadev commented Jul 18, 2022

Cleaned up .gitignore, only beta and .DS_Store are in there now.

Copy link
Owner

@nucliweb nucliweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

.gitignore Outdated
.DS_Store
long-tasks.js
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think to add a "beta" o "canary" folder to add the WIP scripts instead of adding a new file to gitignore every time?

@nucliweb nucliweb merged commit a1cbe10 into main Jul 18, 2022
@nucliweb nucliweb deleted the fix-script-info-timings branch July 18, 2022 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3rd party script timing failing
2 participants