- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 9.8k
 
React: Add components.json for dev and build with examples snippets #32682
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            24 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      67d5780
              
                generate code snippets from csf file
              
              
                kasperpeulen 5efe183
              
                Lot more cases
              
              
                kasperpeulen 446abe5
              
                Cleanup code
              
              
                kasperpeulen ef96eff
              
                Inline args in JSX
              
              
                kasperpeulen 2d86537
              
                More test examples
              
              
                kasperpeulen 3738a60
              
                Add extra tests
              
              
                kasperpeulen 2442574
              
                Fix type error
              
              
                kasperpeulen 18aaaf4
              
                Template.bind expressions
              
              
                kasperpeulen 50ea146
              
                Add componentManifestGenerator preset and implement for react
              
              
                kasperpeulen addd229
              
                Merge remote-tracking branch 'origin/10.1' into kasper/code-snippets
              
              
                kasperpeulen 4ed3856
              
                Fix types
              
              
                kasperpeulen a449847
              
                Update code/core/src/core-server/dev-server.ts
              
              
                kasperpeulen 4ce972a
              
                Update code/core/src/core-server/dev-server.ts
              
              
                kasperpeulen 1599fac
              
                Update code/core/src/core-server/build-static.ts
              
              
                kasperpeulen 1bcd00b
              
                Update code/core/src/core-server/build-static.ts
              
              
                kasperpeulen bf9a49a
              
                Improve dev server logic
              
              
                kasperpeulen f2e3ddb
              
                Merge remote-tracking branch 'origin/kasper/code-snippets' into kaspe…
              
              
                kasperpeulen c0df22c
              
                Add type
              
              
                kasperpeulen 25b197e
              
                Fix lint
              
              
                kasperpeulen 18c671e
              
                Use node logger
              
              
                kasperpeulen 11ac914
              
                Fix
              
              
                kasperpeulen bd91ab6
              
                Fix typos
              
              
                kasperpeulen 1e84547
              
                Remove redundant features fetch
              
              
                kasperpeulen a6f6673
              
                Apply feedback
              
              
                kasperpeulen File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            10 changes: 3 additions & 7 deletions
          
          10 
        
  code/core/src/preview-api/modules/preview-web/render/mount-utils.ts
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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.
Ensure consistent JSON response format and appropriate status codes.
The endpoint has good error handling, but there are inconsistencies:
Response format inconsistency: Success path returns JSON (line 150), but error paths return plain text (lines 154, 159). For a JSON API endpoint, all responses should use JSON format with appropriate Content-Type headers.
Inappropriate 400 status code: Line 153 returns 400 (client error) for "No component manifest generator configured," but this is a server configuration issue, not a client request problem. Use 500 or 503 instead.
Logger lacks context: Line 157's
logger.error(e instanceof Error ? e : String(e))doesn't explain what operation failed. Add a descriptive message like'Failed to generate component manifest'.Apply this diff to improve consistency and clarity:
📝 Committable suggestion
🤖 Prompt for AI Agents