@@ -99,10 +99,27 @@ const LABELS: { [index in PrimaryActionCore]: string } = {
9999
100100export const getExecutionLabel = createSelector ( primaryActionSelector , primaryAction => LABELS [ primaryAction ] ) ;
101101
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+
102119const getStable = ( state : State ) => state . versions . stable ?. rustc ;
103120const getBeta = ( state : State ) => state . versions . beta ?. rustc ;
104121const getNightly = ( state : State ) => state . versions . nightly ?. rustc ;
105- const getRustfmt = ( state : State ) => state . versions . nightly ?. rustfmt ;
122+ const getRustfmt = createSelector ( selectedChannelVersionsSelector , ( versions ) => versions ?. rustfmt ) ;
106123const getClippy = ( state : State ) => state . versions . nightly ?. clippy ;
107124const getMiri = ( state : State ) => state . versions ?. nightly ?. miri ;
108125
@@ -123,8 +140,9 @@ export const miriVersionDetailsText = createSelector(getMiri, versionDetails);
123140
124141const editionSelector = ( state : State ) => state . configuration . edition ;
125142
126- export const isNightlyChannel = ( state : State ) => (
127- state . configuration . channel === Channel . Nightly
143+ export const isNightlyChannel = createSelector (
144+ channelSelector ,
145+ ( channel ) => channel === Channel . Nightly ,
128146) ;
129147export const isHirAvailable = isNightlyChannel ;
130148
@@ -142,10 +160,7 @@ export const getModeLabel = (state: State) => {
142160 return `${ mode } ` ;
143161} ;
144162
145- export const getChannelLabel = ( state : State ) => {
146- const { configuration : { channel } } = state ;
147- return `${ channel } ` ;
148- } ;
163+ export const getChannelLabel = createSelector ( channelSelector , ( channel ) => `${ channel } ` ) ;
149164
150165export const isEditionDefault = createSelector (
151166 editionSelector ,
@@ -311,9 +326,10 @@ export const clippyRequestSelector = createSelector(
311326) ;
312327
313328export const formatRequestSelector = createSelector (
314- codeSelector ,
329+ channelSelector ,
315330 editionSelector ,
316- ( code , edition ) => ( { code, edition } ) ,
331+ codeSelector ,
332+ ( channel , edition , code ) => ( { channel, edition, code } ) ,
317333) ;
318334
319335const focus = ( state : State ) => state . output . meta . focus ;
@@ -387,11 +403,12 @@ export const websocketStatusSelector = createSelector(
387403
388404export const executeRequestPayloadSelector = createSelector (
389405 codeSelector ,
406+ channelSelector ,
390407 ( state : State ) => state . configuration ,
391408 getBacktraceSet ,
392409 ( _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,
395412 mode : configuration . mode ,
396413 edition : configuration . edition ,
397414 crateType,
@@ -403,13 +420,14 @@ export const executeRequestPayloadSelector = createSelector(
403420
404421export const compileRequestPayloadSelector = createSelector (
405422 codeSelector ,
423+ channelSelector ,
406424 ( state : State ) => state . configuration ,
407425 getCrateType ,
408426 runAsTest ,
409427 getBacktraceSet ,
410428 ( _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,
413431 mode : configuration . mode ,
414432 edition : configuration . edition ,
415433 crateType,
0 commit comments