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

Avoid loop with static assets when users pass the --theme-editor-sync flag #4160

Merged
merged 2 commits into from
Jul 5, 2024

Conversation

karreiro
Copy link
Contributor

@karreiro karreiro commented Jul 4, 2024

WHY are these changes introduced?

This PR updates the checksum calculation to avoid loops when users run shopify theme dev --theme-editor-sync and their assets directory has JSON files.

It solves a similar issue addressed by #4142. However, not only the config/settings_schema.json file is sanitized on the platform, but assets/*.json as well. Thus, this PR updates the checksum calculation to reflect that.

WHAT is this pull request doing?

This PR adopts the same approach adopted by #4142 to JSON assets/*.

How to test your changes?

  • Go to your dawn directory
  • Run shopify theme dev --theme-editor-sync
  • Create a file called assets/test.json with this content:
    {
      "test": 1
    }
  • Notice the loop no longer happens

Post-release steps

N/A

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

Copy link
Contributor

github-actions bot commented Jul 4, 2024

Thanks for your contribution!

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

  • Themes: @shopify/advanced-edits
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/app-management

Copy link
Contributor

github-actions bot commented Jul 4, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
72.57% (+0.06% 🔼)
7484/10313
🟡 Branches
69.22% (-0.03% 🔻)
3681/5318
🟡 Functions
71.47% (+0.01% 🔼)
1979/2769
🟡 Lines
72.91% (+0.09% 🔼)
7069/9695

Test suite run success

1722 tests passing in 794 suites.

Report generated by 🧪jest coverage report action from 71c8729

Copy link
Contributor

@jamesmengo jamesmengo left a comment

Choose a reason for hiding this comment

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

🎩 LGTM!

TIL about escape_slash...

@karreiro
Copy link
Contributor Author

karreiro commented Jul 5, 2024

Thank you for the review, @jamesmengo!

I just rolled back the escape_slash change tho. While it was the ideal approach, it's not compatible with Ruby 2.7.5 :( still, I'm maintaining the core of the fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants