Skip to content

Conversation

@asanehisa
Copy link
Contributor

Fixed PromoSection migration so after migration u can still toggle between video + image.
Also adjusted testimonialSectionSlot's constantValue for cardsWrapper.

Before
After

@asanehisa asanehisa marked this pull request as ready for review November 3, 2025 20:22
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

Two migration files were updated to simplify slot presence and data selection. In the promo migration, VideoSlot and ImageSlot are now always-present arrays; slot contents internally select between video vs image via isVideo (using optional chaining for constantValue?.image?.video) and set per-slot fields (assetVideo, image.field, image.constantValue, etc.) accordingly. In the testimonials migration, CardsWrapperSlot's constantValue is always produced as an array of card ID objects (cards.map(c => ({ id: c.props.id }))) regardless of constantValueEnabled.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Migrator as Migration Script
    participant OldSlots as Old Slot Structure
    participant NewSlots as New Slot Structure

    note right of OldSlots `#E8F3FF`: Old flow — conditional slots
    Migrator->>OldSlots: Evaluate isVideo
    alt isVideo true
        OldSlots-->>Migrator: Provide VideoSlot (present), ImageSlot omitted
    else isVideo false
        OldSlots-->>Migrator: Provide ImageSlot (present), VideoSlot omitted
    end

    note right of NewSlots `#F6FFF0`: New flow — always-present slots with internal selection
    Migrator->>NewSlots: Evaluate isVideo (uses optional chaining)
    NewSlots-->>Migrator: Provide VideoSlot array (assetVideo guarded by isVideo)
    NewSlots-->>Migrator: Provide ImageSlot array (image fields chosen based on isVideo)
Loading
sequenceDiagram
    autonumber
    participant Migrator as Migration Script
    participant OldCards as Old CardsWrapperSlot
    participant NewCards as New CardsWrapperSlot

    note right of OldCards `#FFF7E6`: Old flow — conditional constantValue
    Migrator->>OldCards: Check constantValueEnabled
    alt enabled
        OldCards-->>Migrator: constantValue = cards.map(id)
    else disabled
        OldCards-->>Migrator: constantValue = []
    end

    note right of NewCards `#F0F7FF`: New flow — unconditional constantValue
    Migrator->>NewCards: Build constantValue
    NewCards-->>Migrator: constantValue = cards.map(id) (always)
Loading

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes in the pull request, focusing on fixing the PromoSection migration to support Video/Image toggling.
Description check ✅ Passed The description is directly related to the changeset, explaining the PromoSection migration fix and testimonialSectionSlot adjustment with supporting before/after links.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch migration-fix-2

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc1cd43 and 88c2fc5.

📒 Files selected for processing (1)
  • packages/visual-editor/src/components/migrations/0029_promo_section_slots.ts (2 hunks)
🔇 Additional comments (2)
packages/visual-editor/src/components/migrations/0029_promo_section_slots.ts (2)

28-31: LGTM: Safe optional chaining for isVideo computation.

The use of optional chaining (constantValue?.image?.video) correctly guards against undefined intermediate values.


108-162: Approve the always-present slots approach.

The structural change to make VideoSlot and ImageSlot always present (rather than conditionally rendered) aligns well with the PR objective of allowing users to toggle between video and image after migration. The conditional data population based on isVideo is the correct pattern.

Once the critical issue at lines 114-117 is addressed, this implementation will correctly support the toggle functionality.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf6d230 and dc1cd43.

📒 Files selected for processing (2)
  • packages/visual-editor/src/components/migrations/0029_promo_section_slots.ts (1 hunks)
  • packages/visual-editor/src/components/migrations/0036_testimonials_section_slots.ts (1 hunks)
🔇 Additional comments (1)
packages/visual-editor/src/components/migrations/0036_testimonials_section_slots.ts (1)

160-160: LGTM: cards constantValue now mirrors rendered IDs

The array now stays in sync with the generated card props, which should keep the wrapper’s constant value accurate after migration.

benlife5
benlife5 previously approved these changes Nov 3, 2025
@asanehisa asanehisa merged commit 885a26a into fall-2025-slot-ify-components Nov 3, 2025
15 checks passed
@asanehisa asanehisa deleted the migration-fix-2 branch November 3, 2025 21:13
@coderabbitai coderabbitai bot mentioned this pull request Nov 7, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants