@@ -22,13 +22,7 @@ import {
22
22
import { originalToGeneratedId } from "devtools-source-map" ;
23
23
import { prefs } from "../utils/prefs" ;
24
24
25
- import type {
26
- Source ,
27
- SourceId ,
28
- SourceLocation ,
29
- ThreadId ,
30
- WorkerList
31
- } from "../types" ;
25
+ import type { Source , SourceId , SourceLocation , ThreadId } from "../types" ;
32
26
import type { PendingSelectedLocation , Selector } from "./types" ;
33
27
import type { Action , DonePromiseAction , FocusItem } from "../actions/types" ;
34
28
import type { LoadSourceAction } from "../actions/types/SourceAction" ;
@@ -186,9 +180,9 @@ function update(
186
180
function updateSource ( state : SourcesState , source : Object ) {
187
181
const existingSource = state . sources [ source . id ] ;
188
182
return {
189
- ...state ,
183
+ ...state ,
190
184
sources : {
191
- ...state . sources ,
185
+ ...state . sources ,
192
186
[ source . id ] : { ...existingSource , ...source }
193
187
}
194
188
} ;
@@ -198,14 +192,11 @@ function updateSource(state: SourcesState, source: Object) {
198
192
* Update all of the sources when an event occurs.
199
193
* e.g. workers are updated, project directory root changes
200
194
*/
201
- function updateAllSources (
202
- state : SourcesState ,
203
- callback : any
204
- ) {
195
+ function updateAllSources ( state : SourcesState , callback : any ) {
205
196
const updatedSources = Object . values ( state . sources ) . map ( source => ( {
206
197
...source ,
207
198
...callback ( source )
208
- } ) )
199
+ } ) ) ;
209
200
210
201
return addSources ( { ...state , ...emptySources } , updatedSources ) ;
211
202
}
@@ -249,11 +240,12 @@ function addSources(state: SourcesState, sources: Source[]) {
249
240
// 3. Update the displayed actor map
250
241
if (
251
242
underRoot ( source , state . projectDirectoryRoot ) &&
252
- ( ! source . isExtension || getChromeAndExtenstionsEnabled ( { sources : state } ) )
243
+ ( ! source . isExtension ||
244
+ getChromeAndExtenstionsEnabled ( { sources : state } ) )
253
245
) {
254
246
for ( const actor of getSourceActors ( state , source ) ) {
255
247
if ( ! state . displayed [ actor . thread ] ) {
256
- state . displayed [ actor . thread ] = { }
248
+ state . displayed [ actor . thread ] = { } ;
257
249
}
258
250
state . displayed [ actor . thread ] [ source . id ] = true ;
259
251
}
@@ -285,10 +277,9 @@ function updateWorkers(state: SourcesState, action: Object) {
285
277
function updateProjectDirectoryRoot ( state : SourcesState , root : string ) {
286
278
prefs . projectDirectoryRoot = root ;
287
279
288
- return updateAllSources (
289
- { ...state , projectDirectoryRoot : root } ,
290
- source => ( { relativeUrl : getRelativeUrl ( source , root ) } )
291
- ) ;
280
+ return updateAllSources ( { ...state , projectDirectoryRoot : root } , source => ( {
281
+ relativeUrl : getRelativeUrl ( source , root )
282
+ } ) ) ;
292
283
}
293
284
294
285
/*
@@ -301,12 +292,9 @@ function updateLoadedState(state, action: LoadSourceAction): SourcesState {
301
292
302
293
if ( action . status === "start" ) {
303
294
source = { id : sourceId , loadedState : "loading" } ;
304
-
305
295
} else if ( action . status === "error" ) {
306
296
source = { id : sourceId , error : action . error , loadedState : "loaded" } ;
307
-
308
297
} else {
309
-
310
298
if ( ! action . value ) {
311
299
return state ;
312
300
}
@@ -378,7 +366,10 @@ export function getSourceFromId(state: OuterState, id: string): Source {
378
366
return source ;
379
367
}
380
368
381
- export function getSourceByActorId ( state : OuterState , actorId : string ) : ?Source {
369
+ export function getSourceByActorId (
370
+ state : OuterState ,
371
+ actorId : string
372
+ ) : ?Source {
382
373
// We don't index the sources by actor IDs, so this method should be used
383
374
// sparingly.
384
375
for ( const source of getSourceList ( state ) ) {
0 commit comments