Skip to content

Commit

Permalink
Fix shipping cost update when new item is added to cart (#799)
Browse files Browse the repository at this point in the history
* add all variables to shipping react query as a unique key

* updated changelog
  • Loading branch information
martinkuba authored Mar 21, 2023
1 parent ed8ead1 commit aa38fce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ release.
([#795](https://github.com/open-telemetry/opentelemetry-demo/pull/795))
* Add logs for Ad service and Recommendation service
([#796](https://github.com/open-telemetry/opentelemetry-demo/pull/796))
* Fixed shipping update in the frontend UI when number of products in cart changes
([#799](https://github.com/open-telemetry/opentelemetry-demo/pull/799))

## v0.1.0

Expand Down
4 changes: 3 additions & 1 deletion src/frontend/components/CartItems/CartItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const CartItems = ({ productList, shouldShowPrice = true }: IProps) => {
country: 'United States',
zipCode: '94043',
};
const { data: shippingConst = { units: 0, currencyCode: 'USD', nanos: 0 } } = useQuery('shipping', () =>

const { data: shippingConst = { units: 0, currencyCode: 'USD', nanos: 0 } } = useQuery(['shipping',
productList, selectedCurrency, address], () =>
ApiGateway.getShippingCost(productList, selectedCurrency, address)
);

Expand Down

0 comments on commit aa38fce

Please # to comment.