* fix: enforce multifile tab order * fix: sort challengeFiles to prevent remounts If the challengeFiles are used unsorted, this can unmount an editor. The editors rely on the mount hook for initialization, so extra mounts can cause unwanted behaviour. * fix: make editor tabs and panes match
		
			
				
	
	
		
			18 lines
		
	
	
		
			528 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			528 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
exports.toSortedArray = function toSortedArray(challengeFiles) {
 | 
						|
  const xs = challengeFiles;
 | 
						|
  // TODO: refactor this to use an ext array ['html', 'js', 'css'] and loop over
 | 
						|
  // that.
 | 
						|
  xs.sort((a, b) => {
 | 
						|
    if (a.ext === 'html') return -1;
 | 
						|
    if (b.ext === 'html') return 1;
 | 
						|
    if (a.ext === 'css') return -1;
 | 
						|
    if (b.ext === 'css') return 1;
 | 
						|
    if (a.ext === 'jsx') return -1;
 | 
						|
    if (b.ext === 'jsx') return 1;
 | 
						|
    if (a.ext === 'js') return -1;
 | 
						|
    if (b.ext === 'js') return 1;
 | 
						|
    return 0;
 | 
						|
  });
 | 
						|
  return xs;
 | 
						|
};
 |