@@ -62,34 +62,33 @@ export class CallStack extends LitElement {
6262 ] ;
6363
6464 render ( ) {
65- const stack = DatabaseAccess . instance ( ) ?. getStack ( this . timestamp ) . reverse ( ) || [ ] ;
66- if ( stack . length ) {
67- const details = stack . slice ( this . startDepth , this . endDepth ) . map ( ( entry ) => {
68- return this . lineLink ( entry ) ;
69- } ) ;
70-
71- if ( details . length === 1 ) {
72- return details ;
73- }
65+ const stack = DatabaseAccess . instance ( ) ?. getStack ( this . timestamp ) . reverse ( ) ?? [ ] ;
66+ if ( ! stack . length ) {
67+ return html `< div class ="callstack__item "> No call stack available</ div > ` ;
68+ }
7469
75- return html ` < details >
76- < summary > ${ details [ 0 ] } </ summary >
77- < div class =" callstack " > ${ details . slice ( 1 , - 1 ) } </ div >
78- </ details > ` ;
79- } else {
80- return html ` < div class =" callstack__item " > No call stack available </ div > ` ;
70+ const details = stack . slice ( this . startDepth , this . endDepth ) . map ( ( entry ) => {
71+ return this . lineLink ( entry ) ;
72+ } ) ;
73+
74+ if ( details . length === 1 ) {
75+ return details ;
8176 }
77+
78+ const [ first , ...rest ] = details ;
79+ return html `< details >
80+ < summary > ${ first } </ summary >
81+ < div class ="callstack "> ${ rest } </ div >
82+ </ details > ` ;
8283 }
8384
8485 private lineLink ( line : LogEvent ) {
85- return html `
86- < a
87- @click =${ this . onCallerClick }
88- class ="callstack__item code_text"
89- data-timestamp="${ line . timestamp } "
90- > ${ line . text } </ a
91- >
92- ` ;
86+ return html `< a
87+ @click =${ this . onCallerClick }
88+ class ="callstack__item code_text"
89+ data-timestamp="${ line . timestamp } "
90+ > ${ line . text } </ a
91+ > ` ;
9392 }
9493
9594 private onCallerClick ( evt : Event ) {
0 commit comments