-
Notifications
You must be signed in to change notification settings - Fork 273
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
Improve type safety for SEO data utilities #757
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From looking at the changes, it seems you're only making updates to the demo-store implementation, is that correct?
If so, then we don't need a changeset.
Unless you meant to update code in the Hydrogen library itself?
@frehner ah, got it. I took a look at the releases and thought I saw changes to the demo store in there but I must have misunderstood :). I'll remove the changeset. |
Ok, actually, turns out we do need a changeset; but you'll only need to add it to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @davidhousedev. Looks great. Let's merge after the changeset is back in 🙏🏼
@frehner @juanpprieto I don't see |
Hmm, sorry about this @davidhousedev After talking a bit, it seems like the recommendation is to make a changeset for the |
44c9937
to
093f9ac
Compare
No worries @frehner ! Updated 👍🏻 |
Wait something seems weird here - are you targeting the correct branch to merge into? Github is saying |
@frehner I'm targeting the Shopify org repo from my fork, that's why Github is adding the I assumed that Github wouldn't let me push a branch or open a PR in the Shopify org since I'm not a contributor to the repo 🤔 |
I mean, obviously that was our first mistake 😉 |
Good callout, I think you're right. One moment while I update our actions. |
Ok, sorry again! @davidhousedev can you pull in the latest from |
Gonna re-open this with a branch from my fork, so I can keep my forked |
WHY are these changes introduced?
This PR brings more consistency to the typing of the seo data utilities. This preserves internal consistency within the module and will hopefully help folks in userland who bring the seo data utility module into their own repos.
WHAT is this pull request doing?
Previously, the
collection
andproduct
seo data utilities in the demo store inferred the types of the data they returned. In contrast, other seo data utililties annotated the return type with theSeoConfig
generic.I realized that the
product
andcollection
utilities were using extracted functions for creating thejsonLd
values, but those functions returned the incorrect type. I removed the unnecessary array typing and was then able to add the return typing tocollection
andproduct
.Checklist