Studio: Add UI for when local tree for push has errors - #2271
Conversation
| <Icon icon={ cautionFilled } size={ 20 } className="fill-red-600" /> | ||
| { __( | ||
| 'Error retrieving files and directories. Please close and reopen this dialog to try again.' | ||
| ) } |
There was a problem hiding this comment.
I did not add an explicit retry because this seems to be rather an edge case but we can add it if we consider it necessary
📊 Performance Test ResultsComparing e2f610e vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
…or-node-for-fetching-local-tree
gcsecsey
left a comment
There was a problem hiding this comment.
Thanks for adding the error message and for iterating on the styling @katinthehatsite!
Changes LGTM and work well:
| if ( type === 'push' && localFileTreeError ) { | ||
| setTreeState( ( treeState ) => updateNodeById( treeState, 'wp-content', { children: [] } ) ); | ||
| } | ||
| }, [ type, localFileTreeError, setTreeState ] ); |
There was a problem hiding this comment.
I'm not sure if this useEffect is necessary or it could be just an if when rendering the node.children.
| { node.children.length === 0 ? ( | ||
| <div className="text-gray-500 italic" aria-label={ __( 'Empty folder' ) }> | ||
| { __( 'Empty' ) } | ||
| </div> | ||
| renderEmptyContent && renderEmptyContent( node.id ) ? ( | ||
| renderEmptyContent( node.id ) | ||
| ) : ( | ||
| <div className="text-gray-500 italic" aria-label={ __( 'Empty folder' ) }> | ||
| { __( 'Empty' ) } | ||
| </div> |
There was a problem hiding this comment.
I would suggest renaming renderEmptyContent to renderErrorContent. Or in case we want to keep it tied to empty children, then I think we should move the Empty logic into that function too. The condition renderEmptyContent && renderEmptyContent( node.id ) ? seems a bit tricky.


Related issues
Fixes STU-966
Proposed Changes
This PR adds a node to handle errors when there is an issue retrieving nodes from the local tree:
Testing Instructions
npm startSynctabPushSpecific files and foldersoptionwp-content, you see the error shown on the screenshot abovePre-merge Checklist