Skip to content

Commit

Permalink
fix(quick access): wrong navigation when using product commands (#1816)
Browse files Browse the repository at this point in the history
* fix(quick-access): quick access navigates to the old list instead of the pim list

* fix(quick-access): wrong navigation when using Open Variant command

* chore: add changeset

* fix: typescript error

* test: update test
  • Loading branch information
Ahmed Mehri authored Oct 23, 2020
1 parent e824e89 commit 323cf6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-fireants-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-frontend/application-shell': minor
---

Fix wrong navigation when using Quick Access Product commands
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const createCommands = ({
keywords: ['Go to Products'],
action: {
type: actionTypes.go,
to: `/${applicationContext.project.key}/products`,
to: `/${applicationContext.project.key}/products/pim-search`,
},
subCommands: [
hasSomePermissions(
Expand All @@ -68,7 +68,7 @@ const createCommands = ({
text: intl.formatMessage(messages.openProductList),
action: {
type: actionTypes.go,
to: `/${applicationContext.project.key}/products`,
to: `/${applicationContext.project.key}/products/pim-search`,
},
},
hasSomePermissions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ describe('QuickAccess', () => {
fireEvent.keyUp(searchInput, { key: 'Enter' });
await waitFor(() => {
expect(rendered.history.location.pathname).toBe(
'/test-with-big-data/products'
'/test-with-big-data/products/pim-search'
);
});
// should close quick access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const createProductVariantListSubCommands = async ({
data.product.masterData.staged &&
applicationContext.project
) {
const projectKey = applicationContext.project;
const projectKey = applicationContext.project.key;
return data.product.masterData.staged.allVariants.map((variant) => ({
id: `go/product(${productId})/variant(${variant.id})`,
text: formatVariantMessage(variant, intl),
Expand Down

1 comment on commit 323cf6b

@vercel
Copy link

@vercel vercel bot commented on 323cf6b Oct 23, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.