@@ -137,7 +137,6 @@ export const defaultThreadViewOptions: ThreadViewOptions = {
137137 selectedInvertedCallNodePath : [ ] ,
138138 expandedNonInvertedCallNodePaths : new PathSet ( ) ,
139139 expandedInvertedCallNodePaths : new PathSet ( ) ,
140- selectedMarker : null ,
141140 selectedNetworkMarker : null ,
142141 lastSeenTransformCount : 0 ,
143142} ;
@@ -174,20 +173,6 @@ const viewOptionsPerThread: Reducer<ThreadViewOptionsPerThreads> = (
174173 case 'PROFILE_LOADED' :
175174 // The view options are lazily initialized. Reset to the default values.
176175 return { } ;
177- case 'VIEW_FULL_PROFILE' : {
178- // Initialize selectedMarker for each thread from the URL state.
179- const { selectedMarkers } = action ;
180- const newState : ThreadViewOptionsPerThreads = { } ;
181- for ( const [ threadsKey , markerIndex ] of Object . entries ( selectedMarkers ) ) {
182- if ( markerIndex !== null ) {
183- newState [ threadsKey ] = {
184- ..._getThreadViewOptions ( state , threadsKey ) ,
185- selectedMarker : markerIndex ,
186- } ;
187- }
188- }
189- return Object . keys ( newState ) . length > 0 ? newState : state ;
190- }
191176 case 'BULK_SYMBOLICATION' : {
192177 const { oldFuncToNewFuncsMaps } = action ;
193178 // For each thread, apply oldFuncToNewFuncsMap to that thread's
@@ -342,10 +327,6 @@ const viewOptionsPerThread: Reducer<ThreadViewOptionsPerThreads> = (
342327 : { expandedNonInvertedCallNodePaths : expandedCallNodePaths }
343328 ) ;
344329 }
345- case 'CHANGE_SELECTED_MARKER' : {
346- const { threadsKey, selectedMarker } = action ;
347- return _updateThreadViewOptions ( state , threadsKey , { selectedMarker } ) ;
348- }
349330 case 'CHANGE_SELECTED_NETWORK_MARKER' : {
350331 const { threadsKey, selectedNetworkMarker } = action ;
351332 return _updateThreadViewOptions ( state , threadsKey , {
@@ -417,44 +398,24 @@ const viewOptionsPerThread: Reducer<ThreadViewOptionsPerThreads> = (
417398 } ) ;
418399 }
419400 case 'UPDATE_URL_STATE' : {
420- // When the URL state changes (e.g., via browser back button):
421- // 1. Check if the transform stack has been popped for each thread.
422- // If so, reset the stored paths, because they may reference call nodes
423- // that only exist in a transformed tree.
424- // See: https://github.com/firefox-devtools/profiler/issues/5689.
425- // 2. Sync selected marker with URL state.
426-
401+ // When the URL state changes (e.g., via browser back button), check if the
402+ // transform stack has been popped for each thread. If so, reset the stored paths
403+ // because they may reference call nodes that only exist in a transformed tree.
404+ // See: https://github.com/firefox-devtools/profiler/issues/5689
427405 if ( ! action . newUrlState ) {
428406 return state ;
429407 }
430408
431- const { transforms, selectedMarkers } =
432- action . newUrlState . profileSpecific ;
409+ const { transforms } = action . newUrlState . profileSpecific ;
433410 return objectMap ( state , ( viewOptions , threadsKey ) => {
434411 const transformStack = transforms [ threadsKey ] || [ ] ;
435412 const newTransformCount = transformStack . length ;
436413 const oldTransformCount = viewOptions . lastSeenTransformCount ;
437414
438- // Get the selected marker from URL state for this thread
439- const urlSelectedMarker = selectedMarkers [ threadsKey ] ?? null ;
440- const currentSelectedMarker = viewOptions . selectedMarker ;
441-
442- // Check if we need to update anything
443- const transformCountChanged = newTransformCount < oldTransformCount ;
444- const markerChanged = urlSelectedMarker !== currentSelectedMarker ;
445-
446- if ( ! transformCountChanged && ! markerChanged ) {
447- // No change needed
448- return viewOptions ;
449- }
450-
451- // Build the updated view options
452- let updatedOptions = { ...viewOptions } ;
453-
454- // If transform count changed, reset the paths
455- if ( transformCountChanged ) {
456- updatedOptions = {
457- ...updatedOptions ,
415+ // If transform count changed, reset the paths.
416+ if ( newTransformCount < oldTransformCount ) {
417+ return {
418+ ...viewOptions ,
458419 selectedNonInvertedCallNodePath : [ ] ,
459420 selectedInvertedCallNodePath : [ ] ,
460421 expandedNonInvertedCallNodePaths : new PathSet ( ) ,
@@ -463,15 +424,8 @@ const viewOptionsPerThread: Reducer<ThreadViewOptionsPerThreads> = (
463424 } ;
464425 }
465426
466- // If marker changed, sync it from URL state
467- if ( markerChanged ) {
468- updatedOptions = {
469- ...updatedOptions ,
470- selectedMarker : urlSelectedMarker ,
471- } ;
472- }
473-
474- return updatedOptions ;
427+ // No change needed.
428+ return viewOptions ;
475429 } ) ;
476430 }
477431 case 'CHANGE_IMPLEMENTATION_FILTER' : {
0 commit comments