Commit dafe925
fix: don't show file tree view in playground output for single file (#10212)
When an emitter produces a single output file nested in a folder (e.g.
`src/openapi.yaml`), the playground unnecessarily renders the full tree
view with folder navigation panel. This adds clutter for emitters whose
output is always nested.
- Updated `showFileTree` condition in `file-viewer.tsx` to require
`outputFiles.length > 1` before considering folder nesting:
```tsx
// Before
outputFiles.some((f) => f.includes("/")) || outputFiles.length >= 3
// After
outputFiles.length > 1 && (outputFiles.some((f) => f.includes("/")) || outputFiles.length >= 3)
```
Single nested file now renders with the simple tab view; tree view still
activates for 2+ nested files or 3+ flat files.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>1 parent 1f8c6e8 commit dafe925
2 files changed
Lines changed: 10 additions & 1 deletion
File tree
- .chronus/changes
- packages/playground/src/react/output-view
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
0 commit comments