Skip to content

Commit 2c7d663

Browse files
authored
Merge pull request #621 from reactioncommerce/fix-aldeed-tags-api-params
[3.0.0] Fix params for withTag API query
2 parents 8a5f7c2 + 86fc8ed commit 2c7d663

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/components/CheckoutActions/CheckoutActions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const MessageDiv = styled.div`
3636

3737
const NoPaymentMethodsMessage = () => <MessageDiv>No payment methods available</MessageDiv>;
3838

39+
NoPaymentMethodsMessage.renderComplete = () => "";
40+
3941
@withAddressValidation
4042
@track()
4143
@observer

src/containers/tags/tag.gql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import "./tagFragment.gql"
22

3-
query tagQuery($slugOrId: String) {
4-
tag(slugOrId: $slugOrId) {
3+
query tagQuery($shopId: ID!, $slugOrId: String!) {
4+
tag(shopId: $shopId, slugOrId: $slugOrId) {
55
...TagInfo
66
}
77
}

src/containers/tags/withTag.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import tagQuery from "./tag.gql";
1212
* @returns {React.Component} - Component with `tag` prop
1313
*/
1414
export default function withTag(Component) {
15-
@inject("routingStore")
15+
@inject("primaryShopId", "routingStore")
1616
@observer
1717
class WithTag extends React.Component {
1818
static propTypes = {
19+
primaryShopId: PropTypes.string.isRequired,
1920
/**
2021
* slug used to obtain tag info
2122
*/
@@ -27,14 +28,19 @@ export default function withTag(Component) {
2728

2829
render() {
2930
const {
31+
primaryShopId,
3032
router: { query: { slug: slugFromQueryParam } },
3133
routingStore: { tagId }
3234
} = this.props;
3335

3436
const slugOrId = slugFromQueryParam || tagId;
3537

38+
if (!primaryShopId || !slugOrId) {
39+
return <Component {...this.props} />;
40+
}
41+
3642
return (
37-
<Query query={tagQuery} variables={{ slugOrId }}>
43+
<Query query={tagQuery} variables={{ shopId: primaryShopId, slugOrId }}>
3844
{({ error, data }) => {
3945
if (error) {
4046
console.error("WithTag query error:", error); // eslint-disable-line no-console

0 commit comments

Comments
 (0)