jamesfredley commented on code in PR #86:
URL: https://github.com/apache/grails-forge-ui/pull/86#discussion_r2868984854
##########
app/launch/src/components/CodePreview/CodePreview.jsx:
##########
@@ -161,11 +172,15 @@ const CodePreview = ({ theme = 'light', disabled, onLoad,
onClose }, ref) => {
.map((key) => {
const children = nodes[key]
const nodeId = `${rootKey}/${key}`
+ const isFile = typeof children === 'string'
+ const isFolder = typeof children === 'object' && children !== null
+ const className = isFile || isFolder ? '' : 'non-previewable'
return (
<TreeItem
key={nodeId}
nodeId={nodeId}
label={key}
+ className={className}
onClick={() => handleFileSelection(key, children, nodeId)}
Review Comment:
Clicking a folder calls `handleFileSelection(key, children, nodeId)` where
`children` is an object. This sets `currentFile = { contents: null, path:
folderNodeId }`, making the right pane show "This file cannot be previewed."
whenever you expand a folder. Only leaf nodes (files) should trigger file
selection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]