@@ -73,11 +73,14 @@ export class Docs {
7373 const commandIds = [ ] ;
7474
7575 for ( const subtopic of Object . keys ( subtopics ) ) {
76- const subtopicOrCommand = subtopics [ subtopic ] ;
76+ const subtopicOrCommand = isArray ( subtopics [ subtopic ] )
77+ ? Object . assign ( [ ] , subtopics [ subtopic ] )
78+ : Object . assign ( { } , subtopics [ subtopic ] ) ;
79+
7780 try {
7881 if ( ! isArray ( subtopicOrCommand ) ) {
7982 // If it is not subtopic (array) it is a command in the top-level topic
80- const command = subtopicOrCommand ;
83+ const command = Object . assign ( { } , subtopicOrCommand ) ;
8184 const commandMeta = this . resolveCommandMeta ( ensureString ( command . id ) , command , 1 ) ;
8285 await this . populateCommand ( topic , null , command , commandMeta ) ;
8386 commandIds . push ( command . id ) ;
@@ -212,7 +215,7 @@ export class Docs {
212215 }
213216
214217 // Collect all tiers of the meta, so the command will also pick up the topic state (isPilot, etc) if applicable
215- Object . assign ( commandMeta , currentMeta ) ;
218+ Object . assign ( { } , commandMeta , currentMeta ) ;
216219 }
217220 } catch ( error ) {
218221 if ( commandId . endsWith ( part ) ) {
0 commit comments