@@ -68,20 +68,9 @@ export function extractSessionTitle(value: unknown): string | undefined {
6868 return trimmed ;
6969 } ;
7070
71- const normalizeSlug = ( candidate : unknown ) : string | undefined => {
72- if ( typeof candidate !== "string" ) return undefined ;
73- const trimmed = candidate . trim ( ) ;
74- if ( ! trimmed ) return undefined ;
75- if ( trimmed . startsWith ( "new-session" ) ) return undefined ;
76- const spaced = trimmed . replace ( / [ - _ ] + / g, " " ) . trim ( ) ;
77- if ( ! spaced ) return undefined ;
78- return spaced . replace ( / \b \w / g, ( char ) => char . toUpperCase ( ) ) ;
79- } ;
80-
8171 if ( ! value || typeof value !== "object" ) return undefined ;
8272
8373 const queue : unknown [ ] = [ value ] ;
84- let firstSlug : string | undefined ;
8574
8675 while ( queue . length > 0 ) {
8776 const current = queue . shift ( ) ;
@@ -96,26 +85,19 @@ export function extractSessionTitle(value: unknown): string | undefined {
9685 const directTitle = normalizeTitle ( record . title ) ;
9786 if ( directTitle ) return directTitle ;
9887
99- if ( ! firstSlug ) {
100- firstSlug = normalizeSlug ( record . slug ) ?? firstSlug ;
101- }
102-
10388 const info = record . info ;
10489 if ( info && typeof info === "object" && ! Array . isArray ( info ) ) {
10590 const infoRecord = info as Record < string , unknown > ;
10691 const infoTitle = normalizeTitle ( infoRecord . title ) ;
10792 if ( infoTitle ) return infoTitle ;
108- if ( ! firstSlug ) {
109- firstSlug = normalizeSlug ( infoRecord . slug ) ?? firstSlug ;
110- }
11193 }
11294
11395 for ( const nested of Object . values ( record ) ) {
11496 if ( nested && typeof nested === "object" ) queue . push ( nested ) ;
11597 }
11698 }
11799
118- return firstSlug ;
100+ return undefined ;
119101}
120102
121103export function extractPrefixedRecord < TRecord > (
0 commit comments