You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: setItems type fixed in CartProviderState (#84)
* chore: package.lock is updated
* code: added setItems type to CartProviderState
* Added test for setItems
* test: removed .only from setItems tests to run all tests
* fix: updated setItems by the doc requirements
* test: updated setItems test for mock items to not have quantity
* test: added expectation to ensure quantity is implicitly added
* test: added test to ensure setItems does not ignore quantity input
* test: added test to ensure onSetItems is triggered
* test: Updated description for onSetItems trigger test
* test: ensure that setItems replaces the current items
* docs: setItems implicit quantity
* test: fixed false positive for replacing current items with new items
* refactor: setItems, mapping items
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,14 +166,14 @@ ReactDOM.render(
166
166
|`onItemRemove`|_No_| Triggered on items removed from your cart. |
167
167
|`storage`|_No_| Must return `[getter, setter]`. |
168
168
|`metadata`|_No_| Custom global state on the cart. Stored inside of `metadata`. |
169
-
170
169
## `useCart`
171
170
172
171
The `useCart` hook exposes all the getter/setters for your cart state.
173
172
174
173
### `setItems(items)`
175
174
176
-
The `setItems` method should be used to set all items in the cart. This will overwrite any existing cart items.
175
+
The `setItems` method should be used to set all items in the cart. This will overwrite any existing cart items. A `quantity` default of 1 will be set for an item implicitly if no `quantity` is specified.
0 commit comments