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

Add localized description to the dev server kit #2703

Merged
merged 4 commits into from
Sep 4, 2023

Conversation

alfonso-noriega
Copy link
Contributor

@alfonso-noriega alfonso-noriega commented Aug 24, 2023

WHY are these changes introduced?

Enabling localized description for deving ui_extensions.

Fixes #393

The optional description field is supported on the deploy flow for UI Extensions but there was this missing pice to be able to dev it.

WHAT is this pull request doing?

Adding description and the translation logic to the websocket message payloads.

How to test your changes?

  • In the cli folder checkout this branch: git checkout update-drafts-for-all-extensions-in-dev
  • Create a new app and admin extension (or reuse existing ones)
  • Add a new locales entry for the description
  • Add description to the toml file: description: 't:new_key'
  • Run shopify app dev --path your_app_folder_here
  • Open the dev console and navigate to the extension point of your extension
  • Open the web inspector network tab and check the websocket messages contain the description

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-code-tools
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/cli-foundations

@alfonso-noriega alfonso-noriega force-pushed the update-drafts-for-all-extensions-in-dev branch from 9c94483 to 4dc4205 Compare August 24, 2023 15:02
@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
73.32% (+0.01% 🔼)
6009/8196
🟡 Branches
69.93% (+0.02% 🔼)
2926/4184
🟡 Functions 72.21% 1536/2127
🟡 Lines
74.7% (+0.01% 🔼)
5700/7631

Test suite run success

1427 tests passing in 669 suites.

Report generated by 🧪jest coverage report action from 84fddcf

@alfonso-noriega alfonso-noriega changed the title Added localized description to the dev server kit Add localized description to the dev server kit Aug 25, 2023
@alfonso-noriega alfonso-noriega marked this pull request as ready for review August 25, 2023 09:46
@github-actions

This comment has been minimized.

Copy link
Member

@vividviolet vividviolet left a comment

Choose a reason for hiding this comment

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

Looks great - dev flow works. We're just missing a change here to get the description deployed:

@alfonso-noriega alfonso-noriega force-pushed the update-drafts-for-all-extensions-in-dev branch from ad7ee34 to 7417a88 Compare August 29, 2023 09:16
Comment on lines +226 to +231
...(extension.description && {
description:
parsedTranslation && extension.description?.startsWith('t:')
? this._getLocalizedValue(parsedTranslation, extension.description)
: extension.description,
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

probably don't need to check if there is a description, this should be safe:

Suggested change
...(extension.description && {
description:
parsedTranslation && extension.description?.startsWith('t:')
? this._getLocalizedValue(parsedTranslation, extension.description)
: extension.description,
}),
description:
parsedTranslation && extension.description?.startsWith('t:')
? this._getLocalizedValue(parsedTranslation, extension.description)
: extension.description,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't that end up having also a description: undefined value in the payload if there is no description?

Copy link
Contributor

Choose a reason for hiding this comment

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

right, is that a bad thing? if you prefer to not have description at all that's ok for me.
but anyone reading the payload won't care if it's undefined or just not present, the result would be the same no?

Copy link
Member

Choose a reason for hiding this comment

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

It wouldn't make a difference since description is always optional. Consumers of the payload will always need to check if it's present so it doesn't matter if it's undefined or not set.

@alfonso-noriega alfonso-noriega force-pushed the update-drafts-for-all-extensions-in-dev branch 2 times, most recently from 7715a8c to 55128d8 Compare September 1, 2023 12:44
Copy link
Member

@vividviolet vividviolet left a comment

Choose a reason for hiding this comment

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

Looks good aside from the comment about the pnpm-lock. We also need a changeset. Can you generate one please?

@alfonso-noriega alfonso-noriega force-pushed the update-drafts-for-all-extensions-in-dev branch from edcdcb3 to 84fddcf Compare September 4, 2023 09:25
@alfonso-noriega alfonso-noriega added this pull request to the merge queue Sep 4, 2023
Merged via the queue into main with commit c26e4ce Sep 4, 2023
@alfonso-noriega alfonso-noriega deleted the update-drafts-for-all-extensions-in-dev branch September 4, 2023 10:47
@shopify-shipit shopify-shipit bot temporarily deployed to nightly September 4, 2023 10:47 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production September 6, 2023 13:17 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to stable_3_49 September 6, 2023 17:54 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to experimental September 13, 2023 13:24 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.

3 participants