@@ -3,6 +3,7 @@ import { ThunkAction as ReduxThunkAction } from 'redux-thunk';
33import { z } from 'zod' ;
44
55import {
6+ codeSelector ,
67 clippyRequestSelector ,
78 formatRequestSelector ,
89 getCrateType ,
@@ -303,7 +304,8 @@ interface ExecuteRequestBody {
303304
304305const performCommonExecute = ( crateType : string , tests : boolean ) : ThunkAction => ( dispatch , getState ) => {
305306 const state = getState ( ) ;
306- const { code, configuration : { channel, mode, edition } } = state ;
307+ const code = codeSelector ( state ) ;
308+ const { configuration : { channel, mode, edition } } = state ;
307309 const backtrace = state . configuration . backtrace === Backtrace . Enabled ;
308310
309311 if ( useWebsocketSelector ( state ) ) {
@@ -364,7 +366,8 @@ function performCompileShow(
364366 dispatch ( request ( ) ) ;
365367
366368 const state = getState ( ) ;
367- const { code, configuration : {
369+ const code = codeSelector ( state ) ;
370+ const { configuration : {
368371 channel,
369372 mode,
370373 edition,
@@ -677,9 +680,11 @@ export function performMiri(): ThunkAction {
677680 return function ( dispatch , getState ) {
678681 dispatch ( requestMiri ( ) ) ;
679682
680- const { code, configuration : {
683+ const state = getState ( ) ;
684+ const code = codeSelector ( state ) ;
685+ const { configuration : {
681686 edition,
682- } } = getState ( ) ;
687+ } } = state ;
683688 const body : MiriRequestBody = { code, edition } ;
684689
685690 return jsonPost < MiriResponseBody > ( routes . miri , body )
@@ -715,9 +720,11 @@ export function performMacroExpansion(): ThunkAction {
715720 return function ( dispatch , getState ) {
716721 dispatch ( requestMacroExpansion ( ) ) ;
717722
718- const { code, configuration : {
723+ const state = getState ( ) ;
724+ const code = codeSelector ( state ) ;
725+ const { configuration : {
719726 edition,
720- } } = getState ( ) ;
727+ } } = state ;
721728 const body : MacroExpansionRequestBody = { code, edition } ;
722729
723730 return jsonPost < MacroExpansionResponseBody > ( routes . macroExpansion , body )
@@ -783,8 +790,9 @@ export function performGistSave(): ThunkAction {
783790 return function ( dispatch , getState ) {
784791 dispatch ( requestGistSave ( ) ) ;
785792
793+ const state = getState ( ) ;
794+ const code = codeSelector ( state ) ;
786795 const {
787- code,
788796 configuration : {
789797 channel, mode, edition,
790798 } ,
@@ -794,7 +802,7 @@ export function performGistSave(): ThunkAction {
794802 stderr = '' ,
795803 } ,
796804 } ,
797- } = getState ( ) ;
805+ } = state ;
798806
799807 return jsonPost < GistResponseBody > ( routes . meta . gistSave , { code } )
800808 . then ( json => dispatch ( receiveGistSaveSuccess ( { ...json , code, stdout, stderr, channel, mode, edition } ) ) ) ;
0 commit comments