Conversation
… to maintain consistency and improve clarity
…g in footer component elements
…7 compatibility and adjust class styling in cart components
…er UI consistency and user interaction across product options
📝 WalkthroughWalkthroughThis update introduces a comprehensive refactor of the quick shop and product variant selection UI, replacing modal-based flows with Radix Dialog drawers and unifying option selectors. It also implements a manual session cookie management workaround for cart-related routes due to React Router v7 compatibility issues. Additional enhancements include new theme schema settings for quick shop customization, polyfills for multi-cookie header support, and various UI and styling adjustments. Changes
Sequence Diagram(s)Quick Shop Drawer FlowsequenceDiagram
participant User
participant QuickShopTrigger
participant QuickShop (Drawer)
participant QuickShopVariants
participant QuickShopOptionValues
participant ProductDescriptionDrawer
User->>QuickShopTrigger: Clicks "Quick Shop"
QuickShopTrigger->>QuickShop: Opens drawer, fetches product data
QuickShop->>QuickShopVariants: Renders variant selectors
QuickShopVariants->>QuickShopOptionValues: Renders dropdowns with swatches/images
User->>QuickShopOptionValues: Selects option value
QuickShopOptionValues->>QuickShop: Updates selected variant
User->>QuickShop: Clicks "View Description"
QuickShop->>ProductDescriptionDrawer: Opens description drawer with accordion details
Cart Session Cookie Handling (Simplified)sequenceDiagram
participant RouteLoader
participant Session
participant Headers
RouteLoader->>Session: set("cartId", newCartId)
RouteLoader->>Session: commit()
Session-->>RouteLoader: Set-Cookie header value
RouteLoader->>Headers: set("Set-Cookie", value)
RouteLoader->>Client: Responds with headers (including Set-Cookie)
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
app/components/product/quick-shop-option-values.tsx (1)
82-87: Use optional chaining for cleaner code.Apply this change to use optional chaining:
- const found = optionValues.find(({ name: value }) => value === v); - if (found && found.firstSelectableVariant?.id) { - onVariantChange(found.firstSelectableVariant.id); - } + const found = optionValues.find(({ name: value }) => value === v); + if (found?.firstSelectableVariant?.id) { + onVariantChange(found.firstSelectableVariant.id); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
app/components/cart/cart.tsx(1 hunks)app/components/layout/cart-drawer.tsx(1 hunks)app/components/layout/footer.tsx(5 hunks)app/components/link.tsx(1 hunks)app/components/product/product-card-options.tsx(1 hunks)app/components/product/product-option-values.tsx(3 hunks)app/components/product/quantity.tsx(1 hunks)app/components/product/quick-shop-option-values.tsx(1 hunks)app/components/product/quick-shop-variants.tsx(1 hunks)app/components/product/quick-shop.tsx(1 hunks)app/components/product/variants.tsx(1 hunks)app/routes/($locale).cart.$lines.tsx(2 hunks)app/routes/($locale).cart.add.$variantId.ts(2 hunks)app/routes/($locale).cart.tsx(2 hunks)app/routes/($locale).discount.$code.tsx(2 hunks)app/sections/product-information/index.tsx(3 hunks)app/sections/product-information/product-details.tsx(1 hunks)app/weaverse/schema.server.ts(1 hunks)server.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
`**/*.{js,jsx,ts,tsx}`: Replace all imports from Remix packages with their equiv...
**/*.{js,jsx,ts,tsx}: Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
NEVER use 'react-router-dom' imports in this Hydrogen project.
When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/hydrogen-react-router.mdc)
List of files the instruction was applied to:
app/components/cart/cart.tsxapp/components/product/quantity.tsxapp/components/link.tsxapp/components/product/quick-shop-option-values.tsxapp/components/layout/footer.tsxapp/components/product/quick-shop.tsxapp/weaverse/schema.server.tsapp/components/product/product-card-options.tsxapp/routes/($locale).cart.$lines.tsxapp/components/layout/cart-drawer.tsxapp/components/product/variants.tsxapp/sections/product-information/index.tsxapp/components/product/product-option-values.tsxapp/routes/($locale).discount.$code.tsxapp/routes/($locale).cart.add.$variantId.tsapp/sections/product-information/product-details.tsxserver.tsapp/components/product/quick-shop-variants.tsxapp/routes/($locale).cart.tsx
`{app/weaverse/schema.server.ts,app/sections/**/index.tsx,app/components/**/inde...
{app/weaverse/schema.server.ts,app/sections/**/index.tsx,app/components/**/index.tsx}: Always usesettingsinstead ofinspectorin component and theme schemas. Theinspectorkey is deprecated and has been replaced withsettingsfor better consistency with industry standards.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc)
List of files the instruction was applied to:
app/weaverse/schema.server.tsapp/sections/product-information/index.tsx
`app/weaverse/schema.server.ts`: Use the theme schema to define global settings such as typography, colors, and layout defaults, organized in logical groups.
app/weaverse/schema.server.ts: Use the theme schema to define global settings such as typography, colors, and layout defaults, organized in logical groups.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc)
List of files the instruction was applied to:
app/weaverse/schema.server.ts
`app/{sections,components}/**/index.tsx`: Always follow naming conventions for W...
app/{sections,components}/**/index.tsx: Always follow naming conventions for Weaverse components: use PascalCase for component names.
Keep component-specific types in the same file as the component.
Ensure all components have proper schema definitions for the Weaverse builder.
Component-specific types should be colocated with the component implementation.
Each Weaverse component should export a default component (optionally using forwardRef) and aschemaobject created withcreateSchema()that defines the component's properties and UI controls.
For components that need to fetch data, use the component loader pattern and theshouldRevalidate: trueproperty on inputs to automatically refresh data when settings change.
Ensure your Weaverse components provide responsive design settings (e.g., separate settings for desktop, tablet, and mobile columns).
Always implement proper error handling in your Weaverse components, especially for data fetching.
Provide default configurations (presets) for Weaverse components to make them usable out of the box.
Use theconditionproperty in Weaverse schema inputs to show or hide controls based on other settings.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc)
List of files the instruction was applied to:
app/sections/product-information/index.tsx
`server.ts`: Initialize the Weaverse client in your server context and pass the theme schema and components.
server.ts: Initialize the Weaverse client in your server context and pass the theme schema and components.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc)
List of files the instruction was applied to:
server.ts
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
app/components/product/quantity.tsx (4)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure your Weaverse components provide responsive design settings (e.g., separate settings for desktop, tablet, and mobile columns).
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Component-specific types should be colocated with the component implementation.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Provide default configurations (presets) for Weaverse components to make them usable out of the box.
app/components/link.tsx (3)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/weaverse/style.tsx : Apply theme settings as global CSS variables using a GlobalStyle component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Always follow naming conventions for Weaverse components: use PascalCase for component names.
app/components/layout/footer.tsx (3)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure your Weaverse components provide responsive design settings (e.g., separate settings for desktop, tablet, and mobile columns).
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: If following documentation or examples based on Remix, adapt the code to use React Router equivalents.
app/components/product/quick-shop.tsx (1)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : For components that need to fetch data, use the component loader pattern and the `shouldRevalidate: true` property on inputs to automatically refresh data when settings change.
app/weaverse/schema.server.ts (10)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/weaverse/schema.server.ts : Use the theme schema to define global settings such as typography, colors, and layout defaults, organized in logical groups.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to {app/weaverse/schema.server.ts,app/sections/**/index.tsx,app/components/**/index.tsx} : Always use `settings` instead of `inspector` in component and theme schemas. The `inspector` key is deprecated and has been replaced with `settings` for better consistency with industry standards.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to server.ts : Initialize the Weaverse client in your server context and pass the theme schema and components.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure all components have proper schema definitions for the Weaverse builder.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Use the `condition` property in Weaverse schema inputs to show or hide controls based on other settings.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Design your Weaverse schema with intuitive controls, structured groups, and sensible default values.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Provide default configurations (presets) for Weaverse components to make them usable out of the box.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Each Weaverse component should export a default component (optionally using forwardRef) and a `schema` object created with `createSchema()` that defines the component's properties and UI controls.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/weaverse/style.tsx : Access theme settings in your Hydrogen app using the `useThemeSettings` hook from `@weaverse/hydrogen`.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure your Weaverse components provide responsive design settings (e.g., separate settings for desktop, tablet, and mobile columns).
app/components/product/product-card-options.tsx (5)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Provide default configurations (presets) for Weaverse components to make them usable out of the box.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Component-specific types should be colocated with the component implementation.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : NEVER use 'react-router-dom' imports in this Hydrogen project.
app/routes/($locale).cart.$lines.tsx (5)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: If following documentation or examples based on Remix, adapt the code to use React Router equivalents.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Always check existing code in the project to understand which specific React Router hooks and components are being used.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : For components that need to fetch data, use the component loader pattern and the `shouldRevalidate: true` property on inputs to automatically refresh data when settings change.
app/components/layout/cart-drawer.tsx (1)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
app/components/product/variants.tsx (3)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure your Weaverse components provide responsive design settings (e.g., separate settings for desktop, tablet, and mobile columns).
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Always follow naming conventions for Weaverse components: use PascalCase for component names.
app/sections/product-information/index.tsx (4)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Use the `condition` property in Weaverse schema inputs to show or hide controls based on other settings.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to {app/weaverse/schema.server.ts,app/sections/**/index.tsx,app/components/**/index.tsx} : Always use `settings` instead of `inspector` in component and theme schemas. The `inspector` key is deprecated and has been replaced with `settings` for better consistency with industry standards.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure all components have proper schema definitions for the Weaverse builder.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
app/components/product/product-option-values.tsx (6)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Provide default configurations (presets) for Weaverse components to make them usable out of the box.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : For components that need to fetch data, use the component loader pattern and the `shouldRevalidate: true` property on inputs to automatically refresh data when settings change.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to {app/weaverse/schema.server.ts,app/sections/**/index.tsx,app/components/**/index.tsx} : Always use `settings` instead of `inspector` in component and theme schemas. The `inspector` key is deprecated and has been replaced with `settings` for better consistency with industry standards.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : NEVER use 'react-router-dom' imports in this Hydrogen project.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/weaverse/style.tsx : Access theme settings in your Hydrogen app using the `useThemeSettings` hook from `@weaverse/hydrogen`.
app/routes/($locale).discount.$code.tsx (6)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: If following documentation or examples based on Remix, adapt the code to use React Router equivalents.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Always check existing code in the project to understand which specific React Router hooks and components are being used.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Always follow the React Router patterns that are already established in the existing code.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : NEVER use 'react-router-dom' imports in this Hydrogen project.
app/routes/($locale).cart.add.$variantId.ts (4)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : For components that need to fetch data, use the component loader pattern and the `shouldRevalidate: true` property on inputs to automatically refresh data when settings change.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: If following documentation or examples based on Remix, adapt the code to use React Router equivalents.
server.ts (11)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/weaverse/csp.ts : Create a CSP configuration file to ensure your store works correctly with Weaverse.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to server.ts : Initialize the Weaverse client in your server context and pass the theme schema and components.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Provide default configurations (presets) for Weaverse components to make them usable out of the box.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Always implement proper error handling in your Weaverse components, especially for data fetching.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/root.tsx : Wrap your App component with `withWeaverse` to enable Weaverse functionality.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Each Weaverse component should export a default component (optionally using forwardRef) and a `schema` object created with `createSchema()` that defines the component's properties and UI controls.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: If following documentation or examples based on Remix, adapt the code to use React Router equivalents.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : For components that need to fetch data, use the component loader pattern and the `shouldRevalidate: true` property on inputs to automatically refresh data when settings change.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Ensure all components have proper schema definitions for the Weaverse builder.
app/components/product/quick-shop-variants.tsx (2)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Provide default configurations (presets) for Weaverse components to make them usable out of the box.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/cookbook-recipe-weaverse-hydrogen-integration.mdc:0-0
Timestamp: 2025-07-04T07:31:53.832Z
Learning: Applies to app/{sections,components}/**/index.tsx : Keep component-specific types in the same file as the component.
app/routes/($locale).cart.tsx (3)
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Replace all imports from Remix packages with their equivalent React Router v7 packages as specified in the provided mapping table.
Learnt from: CR
PR: Weaverse/aspen#0
File: .cursor/rules/hydrogen-react-router.mdc:0-0
Timestamp: 2025-07-04T07:32:00.233Z
Learning: If following documentation or examples based on Remix, adapt the code to use React Router equivalents.
🧬 Code Graph Analysis (4)
app/components/layout/footer.tsx (1)
app/components/link.tsx (1)
Link(123-193)
app/sections/product-information/index.tsx (4)
app/utils/product.ts (1)
isDiscounted(15-20)app/components/compare-at-price.tsx (1)
CompareAtPrice(5-20)app/components/product/variants.tsx (1)
ProductVariants(4-34)app/components/product/quantity.tsx (1)
Quantity(5-51)
app/components/product/product-option-values.tsx (2)
app/components/image.tsx (1)
Image(31-68)app/utils/misc.ts (2)
isValidColor(19-22)isLightColor(24-27)
app/components/product/quick-shop-variants.tsx (1)
app/components/product/quick-shop-option-values.tsx (1)
QuickShopOptionValues(14-174)
🪛 Biome (1.9.4)
app/components/product/quick-shop-option-values.tsx
[error] 84-84: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
app/components/product/quick-shop.tsx
[error] 100-100: Avoid passing content using the dangerouslySetInnerHTML prop.
Setting content using code can expose users to cross-site scripting (XSS) attacks
(lint/security/noDangerouslySetInnerHtml)
🔇 Additional comments (27)
app/components/cart/cart.tsx (1)
546-546: Verify the price alignment change is intentionalThe change from
ml-autotomr-2removes the automatic right-alignment of the price. This could affect the visual layout of cart items where prices are typically aligned to the right.app/components/link.tsx (1)
50-50: Good fix for CSS variable syntax consistencyThe change from bracket notation to parentheses notation aligns with the syntax used in all other variants in this file, ensuring consistency across the codebase.
app/components/layout/cart-drawer.tsx (1)
61-61: Good explicit positioning improvementAdding
right-0makes the drawer's right-side positioning explicit, which is better than relying on default behavior. This ensures consistent placement across different browsers and contexts.app/components/layout/footer.tsx (1)
106-106: Well-structured layout improvementsThe changes improve the footer's layout precision:
- Conditional padding provides better responsive spacing control
w-fiton links prevents unwanted width expansion and improves click target accuracyThese refinements align with modern CSS best practices for precise layout control.
Also applies to: 188-188, 241-241, 250-250, 277-277
app/weaverse/schema.server.ts (1)
881-919: Well-structured schema additions for Quick Shop functionality.The new settings group follows proper Weaverse schema patterns with logical organization, appropriate input types, and sensible default values. The use of
settingsinstead of the deprecatedinspectorkey aligns with the coding guidelines.app/components/product/product-card-options.tsx (1)
12-12: Good import cleanup removing unused dependencies.Removing unused imports
cnandisValidColorwhile keeping onlyisLightColorimproves code maintainability and follows good practices.app/sections/product-information/product-details.tsx (1)
9-9: Consistent implementation of summary field in product details.The addition of the
summaryfield follows the established pattern for accordion items and maintains consistency with the existing code structure.Also applies to: 13-13
app/components/product/quantity.tsx (1)
20-21: Improved layout and styling consistency.The change from vertical to horizontal layout with justified spacing and the updated legend styling enhances visual consistency with other product components in the UI.
app/routes/($locale).discount.$code.tsx (1)
16-16: Appropriate workaround for React Router v7 compatibility issue.The manual session handling approach properly addresses the compatibility issue with
cart.setCartId(). The implementation correctly sets the cart ID in the session and commits it to generate the appropriate Set-Cookie header.Monitor for when the React Router v7 compatibility issue is resolved to replace this workaround with the proper
cart.setCartId()method.Also applies to: 41-46
app/components/product/variants.tsx (3)
22-22: Enhanced visual hierarchy with improved spacing and dividers.The updated container styling adds better visual separation between product options with increased spacing, subtle dividers, and consistent padding. This creates a cleaner, more organized appearance.
24-24: Improved layout with horizontal alignment.The flex layout with
justify-betweencreates better alignment between option names and their values, making the interface more scannable and professional.
26-26: Consistent typography with medium weight and uppercase styling.The font changes create better visual consistency and hierarchy. The uppercase styling adds emphasis while medium weight provides good readability without being too heavy.
app/routes/($locale).cart.$lines.tsx (2)
23-23: Session destructuring added for manual cookie management.Adding
sessionto the context destructuring is necessary for the React Router v7 compatibility workaround.
56-62: Consistent session cookie management across cart routes verifiedAll
cart.setCartId()calls have been removed and each cart-related route now:
- Persists the cart ID via
session.set("cartId", …).- Instantiates
new Headers()and sets theSet-Cookieheader withawait session.commit().Routes checked:
- app/routes/($locale).cart.tsx
- app/routes/($locale).cart.add.$variantId.ts
- app/routes/($locale).cart.$lines.tsx
- app/routes/($locale).discount.$code.tsx
No further changes required; approving these updates.
app/routes/($locale).cart.tsx (3)
24-24: Consistent session destructuring for cart management.Adding
sessionto the context destructuring follows the established pattern for the React Router v7 workaround.
67-71: Manual session management correctly implemented.The manual session handling properly replaces the
cart.setCartId()functionality with explicit session management and cookie commitment.
77-77: Headers properly included in redirect.The redirect now correctly includes the session headers to ensure the updated cart ID cookie is sent to the client.
app/routes/($locale).cart.add.$variantId.ts (3)
2-2: Redirect import added for consistency.The redirect import aligns with the React Router v7 migration pattern, even though this route uses
data()with headers instead of direct redirect.
5-5: Session context added for manual cart management.Consistent with the established pattern for React Router v7 compatibility.
20-25: Manual session management properly implemented.The workaround correctly handles cart ID persistence by manually setting the session and creating appropriate headers for the response.
app/sections/product-information/index.tsx (3)
78-78: Product summary removed from destructuring.The
summaryfield is no longer extracted from the product object, which aligns with the removal of theshowShortDescriptionfunctionality mentioned in the AI summary.
134-168: Enhanced product information layout with improved organization.The restructured layout provides several improvements:
- Better visual hierarchy: The
space-y-7 divide-y divide-line-subtle [&>*:not(:last-child)]:pb-3classes create clear sections with proper spacing and dividers- Improved price display: Adding the "Price" label makes the interface more user-friendly and professional
- Better component organization: Grouping price, variants, and quantity within the same container creates a logical flow
- Enhanced fallback handling: The simplified fallback for when no variant is selected is cleaner
The changes align well with the broader UI refactoring mentioned in the AI summary and create a more cohesive product information experience.
32-40: ✅ Removal ofshowShortDescriptionVerifiedNo remaining references to
showShortDescriptionwere found across the codebase, and theProductInformationDatainterface inapp/sections/product-information/index.tsxno longer includes it:• Interface now only declares:
addToCartTextsoldOutTextshowVendorshowSalePriceshowShippingPolicyshowRefundPolicyAll removals have been applied correctly.
app/components/product/quick-shop-variants.tsx (1)
1-43: LGTM! Clean implementation of variant selector component.The component correctly handles the edge case of default-only variant products and provides a clean interface for rendering product options. The structure follows React best practices with proper prop typing.
app/components/product/quick-shop-option-values.tsx (1)
1-174: Excellent implementation of option value selector with visual previews.The component provides a great user experience with:
- Visual swatches/images in both the trigger and dropdown items
- Proper handling of invalid/light colors with border styling
- Accessible dropdown implementation using Radix UI
- Clear configuration for which options show swatches vs images
app/components/product/product-option-values.tsx (1)
8-182: Great refactoring to unify option rendering patterns.The changes successfully:
- Consolidate multiple UI patterns into a consistent dropdown interface
- Maintain backward compatibility with the OPTIONS_AS_SWATCH export
- Preserve the navigation logic for variant changes
- Align with the new QuickShopOptionValues component for consistency
The unified approach improves maintainability and user experience.
app/components/product/quick-shop.tsx (1)
171-300: Excellent refactoring of the quick shop functionality.The refactoring brings significant improvements:
- Better mobile UX with drawer instead of modal
- Clean separation of concerns with dedicated components
- Improved loading states with detailed skeleton UI
- Proper error handling
- Accessible implementation using Radix UI
- Internal variant state management appropriate for quick shop context
The code is well-structured and maintainable.
Also applies to: 302-404
| > | ||
| <div | ||
| suppressHydrationWarning | ||
| className="prose dark:prose-invert py-2.5" | ||
| dangerouslySetInnerHTML={{ __html: content }} | ||
| /> |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Potential XSS vulnerability with dangerouslySetInnerHTML.
Using dangerouslySetInnerHTML to render product descriptions and policy content could expose users to XSS attacks if the content isn't properly sanitized.
Let me verify if the content is sanitized before being stored:
Consider using a sanitization library like DOMPurify if the content isn't already sanitized server-side:
+import DOMPurify from 'isomorphic-dompurify';
<div
suppressHydrationWarning
className="prose dark:prose-invert py-2.5"
- dangerouslySetInnerHTML={{ __html: content }}
+ dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }}
/>🏁 Script executed:
#!/bin/bash
# Search for where product descriptions and policies are created/updated
rg -A 10 "description|summary|shippingPolicy|refundPolicy" --type graphql || rg -A 10 "description|summary|shippingPolicy|refundPolicy" app/graphql
# Check if there's any sanitization happening in the codebase
rg -i "sanitize|dompurify|xss|escape.*html" --type ts --type tsx --type js --type jsxLength of output: 1711
🏁 Script executed:
#!/bin/bash
# Search the entire codebase for any sanitization or XSS-protection utilities
rg -i 'dompurify\|sanitizeHtml\|sanitize\|xss'Length of output: 48
Add HTML sanitization around dangerouslySetInnerHTML to prevent XSS
No evidence of any sanitization library or custom escape logic was found in the repo (searched globally for “sanitize”, “dompurify”, “xss”, etc.). Rendering raw HTML from product descriptions and policies creates a potential XSS vector.
• Ensure that all incoming HTML is sanitized server-side, or—better yet—add client-side sanitization before injection
• Install and import a library like isomorphic-dompurify
• Wrap content with a sanitization call in app/components/product/quick-shop.tsx
Suggested diff:
--- a/app/components/product/quick-shop.tsx
+++ b/app/components/product/quick-shop.tsx
@@ -96,7 +96,8 @@ export function QuickShopContent({ content, ... }) {
<div
suppressHydrationWarning
className="prose dark:prose-invert py-2.5"
- dangerouslySetInnerHTML={{ __html: content }}
+ dangerouslySetInnerHTML={{
+ __html: DOMPurify.sanitize(content),
+ }}
/>- yarn add isomorphic-dompurify
import DOMPurify from 'isomorphic-dompurify';at top of the file- Confirm with your backend team that no unsafe HTML can slip through
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| > | |
| <div | |
| suppressHydrationWarning | |
| className="prose dark:prose-invert py-2.5" | |
| dangerouslySetInnerHTML={{ __html: content }} | |
| /> | |
| > | |
| <div | |
| suppressHydrationWarning | |
| className="prose dark:prose-invert py-2.5" | |
| - dangerouslySetInnerHTML={{ __html: content }} | |
| + dangerouslySetInnerHTML={{ | |
| + __html: DOMPurify.sanitize(content), | |
| + }} | |
| /> |
🧰 Tools
🪛 Biome (1.9.4)
[error] 100-100: Avoid passing content using the dangerouslySetInnerHTML prop.
Setting content using code can expose users to cross-site scripting (XSS) attacks
(lint/security/noDangerouslySetInnerHtml)
🤖 Prompt for AI Agents
In app/components/product/quick-shop.tsx around lines 96 to 101, the raw HTML
content is injected using dangerouslySetInnerHTML without sanitization, which
risks XSS attacks. To fix this, install the isomorphic-dompurify library, import
DOMPurify at the top of the file, and wrap the content variable with
DOMPurify.sanitize before passing it to dangerouslySetInnerHTML. Also, confirm
with the backend team that no unsafe HTML bypasses server-side checks.
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Style