Skip to content

Duplicate view path prompt in block generator #364

@enriquo

Description

@enriquo

The wp acorn acf:block command prompts for view path selection 4 times instead of once, creating an annoying loop before successfully generating the block.

Environment:

  • ACF Composer version: v3.4.4
  • Acorn version: v5.0.5
  • OS: Windows 11

Command:
wp acorn acf:block SectionBlock

Expected behavior:
The view path prompt should appear once and accept the selection.

Actual behavior:
The prompt "Where do you want to create the view(s)?" appears 4 times in a loop before finally creating the block and view files successfully.

Console output:

PS D:\...\wp-content\themes\webshore> wp acorn acf:block SectionBlock

  Enter the block description:
❯ Section

  Select the block category: [common]
  Texto ....................................................................................................................................... text  
  Medios ..................................................................................................................................... media
  Diseño .................................................................................................................................... design
  Widgets .................................................................................................................................. widgets
  Tema ....................................................................................................................................... theme
  Incrustados ................................................................................................................................ embed
  Patrones ................................................................................................................................ reusable
❯ design

  Select the supported post types: [None]
  None .............................................................................................................................................
  Post ........................................................................................................................................ post
  Page ........................................................................................................................................ page  
  Attachment ............................................................................................................................ attachment
❯ 

  Select the supported block features: [align,mode,multiple,jsx]
  None .............................................................................................................................................
  Align ...................................................................................................................................... align
  Align Text ............................................................................................................................ align_text
  Align Content ...................................................................................................................... align_content
  Full Height .......................................................................................................................... full_height
  Anchor .................................................................................................................................... anchor
  Mode ........................................................................................................................................ mode
  Multiple ................................................................................................................................ multiple
  Jsx .......................................................................................................................................... jsx
  Background Color ...................................................................................................................... background
  Text Color .................................................................................................................................. text
  Gradients Color ........................................................................................................................ gradients
  Padding Spacing .......................................................................................................................... padding
  Margin Spacing ............................................................................................................................ margin
❯ jsx,background,text,multiple,anchor      

 Where do you want to create the view(s)? [D:\...\resources\views]:
  [0] D:\...\wp-content\themes\webshore\resources\views
  [2] D:\...\wp-content\themes\webshore\resources\views
 > 0

 Where do you want to create the view(s)? [D:\...\wp-content\themes\webshore\resources\views]:
  [0] D:\...\wp-content\themes\webshore\resources\views
  [2] D:\...\wp-content\themes\webshore\resources\views
 > 0

 Where do you want to create the view(s)? [D:\...\wp-content\themes\webshore\resources\views]:
  [0] D:\...\wp-content\themes\webshore\resources\views
  [2] D:\...\wp-content\themes\webshore\resources\views
 > 0

🎉 SectionBlock block successfully composed.
     ⮑  webshore\app/Blocks/SectionBlock.php

 Where do you want to create the view(s)? [D:\...\wp-content\themes\webshore\resources\views]:
  [0] D:\...\wp-content\themes\webshore\resources\views
  [2] D:\...\wp-content\themes\webshore\resources\views
 > 0

     ⮑  D:\...\wp-content\themes\webshore\resources\views/blocks/section-block.blade.php

Additional observations:

  1. The prompt shows options [0] and [2] (skips [1]) - both pointing to the same path
  2. Files are created successfully despite the repeated prompts
  3. The final output mixes path separators (\ and /)
  4. This happens consistently on every block generation

Possible cause:
May be related to Windows path handling or view path resolution logic repeating unnecessarily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions