-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use quantity state #95
Conversation
yurii-ve
commented
Oct 16, 2024
- keep item quantity in component state
- set quantity to 1 on option change
@@ -129,6 +128,7 @@ export default function ProductDetailsPage() { | |||
option={option} | |||
selectedChoice={selectedChoices[option.name!]} | |||
onChange={(newSelectedChoice) => { | |||
setQuantity(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we want to reset quantity on option change?
also, are you going to handle quantity in stock in future PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we want to reset quantity on option change?
this is how wix template behaves.. kind of makes sense I guess
also, are you going to handle quantity in stock in future PRs?
not for now
* Remove app board (#70) * Update error handling (#72) * Remove app board (#70) (#71) * Update error handling * Create CartItemView component, update ProductCard board (#74) * Create CartItemView component * Update product card board * Updated UI kit components board * Resolve comments * Resolve comments 2 * Update codux config to use .env file (#76) * Handle trackQuantity property for out of stock indication (#80) * Keep entire selected choice object in route state (#81) * Keep entire selected choice object in route state * Remove console.log * Add return types, update comment * Update helper name and added comment * Use selected choice media (#82) * fix: out of stock indication for products with variants (#83) * refactor: improve fix regarding navigation from error boundary (#84) * refactor: improve fix regarding navigation from error boundary * remove console.log * Fix missing SKU issue (#85) * Remove redundant instruction (#86) * Change background-color to background, use color variables (#87) * Remove absolute positioning from the intro board (#88) * Remove absolute positioning from the intro board * Fix tabs * Remove redundant style * Split Cart component into functional (Cart) and view parts (CartView) (#90) * Update cart related boards (#91) * Added useCart hook (#92) * Remove cart loading state (#93) * Update drawer component (#94) * feat: hide non-visible variants to disallow selection (#89) * feat: hide non-visible variatns to disallow selection * rename * some refactoring * refactor * rename * refactor non visible choices, add out of stock choices * review comments * fix review comments * Use quantity state (#95) * Export addToCart from the useCart hook (#96) * refactor: improve select types (#97) * refactor: improve select types * fix logic * fix comment * feat: products filtering and sorting (#98) * added sorting and filters * improve responsive views * prettify files * Sync latest changes from the ReClaim template (#102) * Add lib folder, user session * Update dependencies * Update codux config * Fix * Define DEMO_STORE_WIX_CLIENT_ID in the src * Add getStaticRoutes * Prettier * Prettier * Add faker * Update package-lock * Put canonical links back * Fix duplicate import * Remove redundant code --------- Co-authored-by: olehrakwix <[email protected]>
* Remove app board (#70) * Update error handling (#72) * Remove app board (#70) (#71) * Update error handling * Create CartItemView component, update ProductCard board (#74) * Create CartItemView component * Update product card board * Updated UI kit components board * Resolve comments * Resolve comments 2 * Update codux config to use .env file (#76) * Handle trackQuantity property for out of stock indication (#80) * Keep entire selected choice object in route state (#81) * Keep entire selected choice object in route state * Remove console.log * Add return types, update comment * Update helper name and added comment * Use selected choice media (#82) * fix: out of stock indication for products with variants (#83) * refactor: improve fix regarding navigation from error boundary (#84) * refactor: improve fix regarding navigation from error boundary * remove console.log * Fix missing SKU issue (#85) * Remove redundant instruction (#86) * Change background-color to background, use color variables (#87) * Remove absolute positioning from the intro board (#88) * Remove absolute positioning from the intro board * Fix tabs * Remove redundant style * Split Cart component into functional (Cart) and view parts (CartView) (#90) * Update cart related boards (#91) * Added useCart hook (#92) * Remove cart loading state (#93) * Update drawer component (#94) * feat: hide non-visible variants to disallow selection (#89) * feat: hide non-visible variatns to disallow selection * rename * some refactoring * refactor * rename * refactor non visible choices, add out of stock choices * review comments * fix review comments * Use quantity state (#95) * Export addToCart from the useCart hook (#96) * refactor: improve select types (#97) * refactor: improve select types * fix logic * fix comment * feat: products filtering and sorting (#98) * added sorting and filters * improve responsive views * prettify files * Sync latest changes from the ReClaim template (#102) * Add lib folder, user session * Update dependencies * Update codux config * Fix * Define DEMO_STORE_WIX_CLIENT_ID in the src * Add getStaticRoutes * Prettier * Prettier * Add faker * Update package-lock * Put canonical links back * Fix duplicate import * chore(deps): upgrade to latest (#104) * refactor: replace css reset (#107) * Fix (#111) * Use component wrapper instead of memory router (#112) * Update/fix meta tags (#105) * Update meta tags * Change var name * Change title * Remove favicon links * Remove canonical links * Fix lint * Simplify non-essential routes * FIx * Fix * Update package-lock * Remove redundant util --------- Co-authored-by: olehrakwix <[email protected]> Co-authored-by: Pilar Buchen <[email protected]> Co-authored-by: Ido Rosenthal <[email protected]>
* Remove app board (#70) * Update error handling (#72) * Remove app board (#70) (#71) * Update error handling * Create CartItemView component, update ProductCard board (#74) * Create CartItemView component * Update product card board * Updated UI kit components board * Resolve comments * Resolve comments 2 * Update codux config to use .env file (#76) * Handle trackQuantity property for out of stock indication (#80) * Keep entire selected choice object in route state (#81) * Keep entire selected choice object in route state * Remove console.log * Add return types, update comment * Update helper name and added comment * Use selected choice media (#82) * fix: out of stock indication for products with variants (#83) * refactor: improve fix regarding navigation from error boundary (#84) * refactor: improve fix regarding navigation from error boundary * remove console.log * Fix missing SKU issue (#85) * Remove redundant instruction (#86) * Change background-color to background, use color variables (#87) * Remove absolute positioning from the intro board (#88) * Remove absolute positioning from the intro board * Fix tabs * Remove redundant style * Split Cart component into functional (Cart) and view parts (CartView) (#90) * Update cart related boards (#91) * Added useCart hook (#92) * Remove cart loading state (#93) * Update drawer component (#94) * feat: hide non-visible variants to disallow selection (#89) * feat: hide non-visible variatns to disallow selection * rename * some refactoring * refactor * rename * refactor non visible choices, add out of stock choices * review comments * fix review comments * Use quantity state (#95) * Export addToCart from the useCart hook (#96) * refactor: improve select types (#97) * refactor: improve select types * fix logic * fix comment * feat: products filtering and sorting (#98) * added sorting and filters * improve responsive views * prettify files * Sync latest changes from the ReClaim template (#102) * Add lib folder, user session * Update dependencies * Update codux config * Fix * Define DEMO_STORE_WIX_CLIENT_ID in the src * Add getStaticRoutes * Prettier * Prettier * Add faker * Update package-lock * Put canonical links back * Fix duplicate import * chore(deps): upgrade to latest (#104) * refactor: replace css reset (#107) * Fix (#111) * Use component wrapper instead of memory router (#112) * Update/fix meta tags (#105) * Update meta tags * Change var name * Change title * Remove favicon links * Remove canonical links * Fix lint * Simplify non-essential routes * FIx * Fix * fix: regenerate lock file fixes run dev (#116) * fix: position page layout correctly (#117) * refactor: replace import with use (#118) * remove import * run install --------- Co-authored-by: Yurii Venher <[email protected]> Co-authored-by: olehrakwix <[email protected]> Co-authored-by: Pilar Buchen <[email protected]> Co-authored-by: Ido Rosenthal <[email protected]>