Skip to content

Commit

Permalink
Fix shipping cost update when new item is added to cart (open-telemet…
Browse files Browse the repository at this point in the history
…ry#799)

* add all variables to shipping react query as a unique key

* updated changelog
  • Loading branch information
martinkuba committed Mar 21, 2023
1 parent a49b0d1 commit 408e573
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 408e573

Please sign in to comment.