Step 8: Patches - Apply a Diff

Remember from the semantic versioning convention we use that patches can include bug fixes, including for styling regressions. There may come a time when you want to add a particular bug fix to your experience to target a specific issue without doing a full theme upgrade. You can do that easily via Tools > Apply Diff. This is also a great way to share updates between your repos or share a cool update with a colleague.

Use Case: Let’s say your Search experience is on Theme v1.22.0 and the latest version released is 1.25.0. However, you realize that Theme v1.22.1 includes a fix so that analytics events are fired when rich text field links are clicked in a result card. This is important to your experience, but you don’t want to do a full theme upgrade to 1.25.0. You can apply a diff!

Note: Patch updates are not included in the changelog, but may be found in the Community.

Steps to Applying a Diff

You’ll notice that these steps are similar to the steps above for upgrading your experience. That’s because this is a partial upgrade and you’ll want to follow similar steps to prepare for and then QA your experience.

  1. Check which version of the theme you are currently on by looking in the package.json file.
  2. Find the Community post for the patch you would like to add to your experience.
  3. Read through the upgrade implications thoroughly and note any actions you may need to take before or after applying the patch.
  4. Make any changes needed before applying the patch, such as overriding any standard cards you want to keep as-is if the upgrade will change them.
  5. Click on Tools > Apply Diff in the top right of your Code Editor.

    Code Editor screen with Tools > Apply Diff highlighted

  6. Select the diff file you want to apply by entering the URL of a diff file or uploading a diff file (click Upload). For standalone features or bug fixes, you may find the diff URL in the Community post. Don’t see one that you need? Comment on the post and ask for it!

    Code Editor screen with Apply Diff popup

    Click View to preview the changes that will be applied. Click Apply to apply the changes.

  7. Make any changes needed after the diff file is applied, including:

    • Re-forking certain files as directed to in the upgrade implications of the patch Community post.
    • Following any instructions in the Community post needed to configure the patch update.
  8. Test Live Preview thoroughly to ensure it works and functions how you expect it would.

  9. Commit your changes once Live Preview looks good. Then publish the commit to Production and do some light testing.

  10. You’re done!

Feedback