Unnecessary context value updates in ShopifyProvider component #2279
ekaterina-nikitina-de
started this conversation in
Ideas + Feature Requests
Replies: 1 comment 1 reply
-
Is this affecting your app's performance? It seems like a micro-optimization. Happy to accept a PR though. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The spread operator creates a new object every time and that makes the context provider propagate new value on every render even if nothing was really changed in the props.
Proposal:
Replace the spread operator here and further with direct props as they are primitives:
hydrogen/packages/hydrogen-react/src/ShopifyProvider.tsx
Line 32 in 8b9c726
MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#spread_in_object_literals
Beta Was this translation helpful? Give feedback.
All reactions