@@ -99,10 +99,27 @@ const LABELS: { [index in PrimaryActionCore]: string } = {
99
99
100
100
export const getExecutionLabel = createSelector ( primaryActionSelector , primaryAction => LABELS [ primaryAction ] ) ;
101
101
102
+ const channelSelector = ( state : State ) => state . configuration . channel ;
103
+
104
+ const selectedChannelVersionsSelector = createSelector (
105
+ channelSelector ,
106
+ ( state : State ) => state . versions ,
107
+ ( channel , versions ) => {
108
+ switch ( channel ) {
109
+ case Channel . Stable :
110
+ return versions . stable ;
111
+ case Channel . Beta :
112
+ return versions . beta ;
113
+ case Channel . Nightly :
114
+ return versions . nightly ;
115
+ }
116
+ } ,
117
+ )
118
+
102
119
const getStable = ( state : State ) => state . versions . stable ?. rustc ;
103
120
const getBeta = ( state : State ) => state . versions . beta ?. rustc ;
104
121
const getNightly = ( state : State ) => state . versions . nightly ?. rustc ;
105
- const getRustfmt = ( state : State ) => state . versions . nightly ?. rustfmt ;
122
+ const getRustfmt = createSelector ( selectedChannelVersionsSelector , ( versions ) => versions ?. rustfmt ) ;
106
123
const getClippy = ( state : State ) => state . versions . nightly ?. clippy ;
107
124
const getMiri = ( state : State ) => state . versions ?. nightly ?. miri ;
108
125
@@ -123,8 +140,9 @@ export const miriVersionDetailsText = createSelector(getMiri, versionDetails);
123
140
124
141
const editionSelector = ( state : State ) => state . configuration . edition ;
125
142
126
- export const isNightlyChannel = ( state : State ) => (
127
- state . configuration . channel === Channel . Nightly
143
+ export const isNightlyChannel = createSelector (
144
+ channelSelector ,
145
+ ( channel ) => channel === Channel . Nightly ,
128
146
) ;
129
147
export const isHirAvailable = isNightlyChannel ;
130
148
@@ -142,10 +160,7 @@ export const getModeLabel = (state: State) => {
142
160
return `${ mode } ` ;
143
161
} ;
144
162
145
- export const getChannelLabel = ( state : State ) => {
146
- const { configuration : { channel } } = state ;
147
- return `${ channel } ` ;
148
- } ;
163
+ export const getChannelLabel = createSelector ( channelSelector , ( channel ) => `${ channel } ` ) ;
149
164
150
165
export const isEditionDefault = createSelector (
151
166
editionSelector ,
@@ -311,9 +326,10 @@ export const clippyRequestSelector = createSelector(
311
326
) ;
312
327
313
328
export const formatRequestSelector = createSelector (
314
- codeSelector ,
329
+ channelSelector ,
315
330
editionSelector ,
316
- ( code , edition ) => ( { code, edition } ) ,
331
+ codeSelector ,
332
+ ( channel , edition , code ) => ( { channel, edition, code } ) ,
317
333
) ;
318
334
319
335
const focus = ( state : State ) => state . output . meta . focus ;
@@ -387,11 +403,12 @@ export const websocketStatusSelector = createSelector(
387
403
388
404
export const executeRequestPayloadSelector = createSelector (
389
405
codeSelector ,
406
+ channelSelector ,
390
407
( state : State ) => state . configuration ,
391
408
getBacktraceSet ,
392
409
( _state : State , { crateType, tests } : { crateType : string , tests : boolean } ) => ( { crateType, tests } ) ,
393
- ( code , configuration , backtrace , { crateType, tests } ) => ( {
394
- channel : configuration . channel ,
410
+ ( code , channel , configuration , backtrace , { crateType, tests } ) => ( {
411
+ channel,
395
412
mode : configuration . mode ,
396
413
edition : configuration . edition ,
397
414
crateType,
@@ -403,13 +420,14 @@ export const executeRequestPayloadSelector = createSelector(
403
420
404
421
export const compileRequestPayloadSelector = createSelector (
405
422
codeSelector ,
423
+ channelSelector ,
406
424
( state : State ) => state . configuration ,
407
425
getCrateType ,
408
426
runAsTest ,
409
427
getBacktraceSet ,
410
428
( _state : State , { target } : { target : string } ) => ( { target } ) ,
411
- ( code , configuration , crateType , tests , backtrace , { target } ) => ( {
412
- channel : configuration . channel ,
429
+ ( code , channel , configuration , crateType , tests , backtrace , { target } ) => ( {
430
+ channel,
413
431
mode : configuration . mode ,
414
432
edition : configuration . edition ,
415
433
crateType,
0 commit comments