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 loading JS functions & Improve theme dev loading time #1418

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Feb 22, 2023

WHY are these changes introduced?

Bugs found during the release QA

WHAT is this pull request doing?

  • JS functions weren't loading correctly if there were other UI extensions present, fixed that.
  • Theme dev was adding an extra waiting time that wasn't necessary on the first run.

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

@github-actions
Copy link
Contributor

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/theme-developer-tools
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/cli-foundations

) {
await sleep(3)
if (shouldWait) await sleep(3)
Copy link
Contributor

@Arkham Arkham Feb 22, 2023

Choose a reason for hiding this comment

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

wat? why were we sleeping in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to.
The theme server is restarted every 2h (to refresh the tokens), but when we close a process and start a new one, there is chance that the port is not ready yet, so we need to wait a bit.

But that wait shouldn't happen on the first run, only when we restart the server.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I see, it's not the end of the world then. In theory we could use functions from https://github.com/unjs/get-port-please (which we already have as a dep) to check if the port is available for use :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it was a temporary solution, the idea is that dev should handle token refresh internally, but that won't happen until the command is ported from Ruby...

@github-actions
Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
72.83% (+0.07% 🔼)
4146/5693
🟡 Branches 69.63% 1871/2687
🟡 Functions
70.33% (+0.06% 🔼)
1095/1557
🟡 Lines
74.12% (+0.07% 🔼)
3956/5337

Test suite run success

1056 tests passing in 534 suites.

Report generated by 🧪jest coverage report action from 7925a40

Copy link
Contributor

@Arkham Arkham left a comment

Choose a reason for hiding this comment

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

👍

@isaacroldan isaacroldan merged commit 759d3ae into main Feb 22, 2023
@isaacroldan isaacroldan deleted the fix-loading-js-functions branch February 22, 2023 09:45
@shopify-shipit shopify-shipit bot temporarily deployed to nightly February 22, 2023 12:56 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production February 22, 2023 16:13 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to stable_3_44 February 23, 2023 11:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants