-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fixed browser Back Button anomaly on PDP #3032
Conversation
@@ -272,7 +272,7 @@ function composer(props, onData) { | |||
const tagSub = Meteor.subscribe("Tags"); | |||
const shopIdOrSlug = Reaction.Router.getParam("shopSlug"); | |||
const productId = Reaction.Router.getParam("handle"); | |||
const variantId = Reaction.Router.getParam("variantId"); | |||
const variantId = ReactionProduct.selectedVariant()._id; |
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.
You could probably use ReactonProduct.selectedVariantId()
instead.
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 I just refactored it to selectedVariantId()
c041aae
to
0446f06
Compare
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.
This works and fixes the problem but I want to understand why the change to branchAsset is in here. Is it part of this fix?
@@ -19,7 +19,7 @@ function composer(props, onData) { | |||
} | |||
|
|||
if (shop && Array.isArray(shop.brandAssets)) { | |||
const brandAsset = _.find(this.getShop().brandAssets, (asset) => asset.type === "navbarBrandImage"); |
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.
Is there a reason this change was added to this PR? If this is fixing an another issue it should be explicitly called out in the comments. Generally we should keep bugfix PR's pretty focused on fixing just the one issue.
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.
I got that change in brandAssets
when I pulled recent changes from marketplace branch.
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.
how would that be possible? If you are up to date with marketplace then why would you have that change? Did you merge a conflict?
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.
I made a typographical error in my commit message so I reset my HEAD and unknowingly unstaged the change that was made to the brandAssets
.
@@ -19,7 +19,7 @@ function composer(props, onData) { | |||
} | |||
|
|||
if (shop && Array.isArray(shop.brandAssets)) { | |||
const brandAsset = _.find(this.getShop().brandAssets, (asset) => asset.type === "navbarBrandImage"); | |||
const brandAsset = _.find(shop.brandAssets, (asset) => asset.type === "navbarBrandImage"); |
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.
This is identical to the line in the current marketplace
branch so I'm confused as to why it's showing this as a change, but it appears to be correct.
https://github.com/reactioncommerce/reaction/blob/marketplace/imports/plugins/core/ui-navbar/client/containers/navbar.js#L22
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.
I pulled the latest changes from marketplace , I made a typographical error in my commit message so I reset my HEAD and unknowingly unstaged the change that was made to the brandAssets
.
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.
Approving the code as the change to navbar.js line 22 appears to be identical to the current marketplace
branch.
Resolves #2660 ,
So there was a
Router.go
snippet invaraintList.js
that was changing the URL when a variant is selected, so based on @mikemurray comment on how to fix the issue , I refactored the composer object (inproductDetail.js
) to get variantId by usingReactionProduct.selectedVariant()._id
rather than fetching it as a param from the URL.HOW TO TEST