-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
#3286 + #3332 catalog-next
module improvements
#3295
#3286 + #3332 catalog-next
module improvements
#3295
Conversation
… module extension and implement it into our modules * @todo: remove module-extension when #3295 is approved and merged
* Change `category-next/getCurrentCategory` as module extension and implement it into our modules * @todo: remove module-extension when #3295 is approved and merged
Looks good, awesome job 👍 |
Thanks @cewald, i think it's better to improve category match pattern instead of extending state to store categoryId. Removing it was a purpose to have single source of truth in url without need to set it maunually. |
@patzick I totally like this approach of having a "true" single source of truth, thats why I just added the ID instead of a own category object, but yes indeed it would be better to get that without a extra state entry. But how is it then possible to see if this url-key is probably connected to a custom route if I don't use the url-key in category-state? For example I added a route like via a custom url
A use-case for that is to have custom url's for a specific standard route. For example: our marketing want's an url that isn't conform with our default url-category pattern but then again sounds better in communication. |
@patzick I updated my pull request as you said. I found a way to traverse the current url in a better way without the need of an extra current category state. I was able to get the current category in a more specific way than using url-key, by using the I put it into a new method so we still have both ways – there are use-cases when it's enough to look just after the url-key. |
catalog-next
module improvements
… parameters are added
@cewald is this one ready to be merged in? |
awesome job by the way @cewald :-) |
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.
Just a very very small change suggested; overall: great job
Thasnk |
…egories won't be updated at changes
}) | ||
state.categoriesMap = Object.assign(state.categoriesMap, newCategoriesEntry) |
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'll only change that back for one reason - with every category vue will mutate state and will invoke recalculate all computed properties and getters which are based on this. Fix for reactivity here is actually change
state.categoriesMap = Object.assign(state.categoriesMap, newCategoriesEntry)
to
state.categoriesMap = Object.assign({}, state.categoriesMap, newCategoriesEntry)
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.
Ah nice, didn't figured that out :)
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.
Great work @cewald , i'll only change back CATEGORY_ADD_CATEGORIES to invoke state mutation once, but overall really great job! :)
Related issues
closes #3286 and #3332
Short description and why it's useful
I added a new state item, containing the current category id, to be able to traverse the current category even if the current route path is not the same as in
url_path
norslug
(e.g. if you use rewrites). I decided to use just the id incurrentId
state property to prevent duplicate content in the state, because the category is already incategoriesMap
.Also I changed how the filter for the category is added to the action in the category page. This way you don't need to ask for
config.products.useMagentoUrlKeys
and use just the given parameters of the current route. This is more specific and also more flexible than just get it by the path.And I fixed the bug mentioned in #3286 where it sometimes returns the wrong category because of the flacky
include()
-search in thegetCategoryFrom()
getter.Which environment this relates to
Check your case. In case of any doubts please read about Release Cycle
develop
branch and want to merge it back todevelop
release
branch and want to merge it back torelease
hotfix
ormaster
branch and want to merge it back tohotfix
Upgrade Notes and Changelog
IMPORTANT NOTICE - Remember to update
CHANGELOG.md
with description of your changeContribution and currently important rules acceptance