@@ -4,6 +4,7 @@ import url, { UrlObject } from 'url';
4
4
import { z } from 'zod' ;
5
5
6
6
import {
7
+ codeSelector ,
7
8
clippyRequestSelector ,
8
9
formatRequestSelector ,
9
10
getCrateType ,
@@ -304,7 +305,8 @@ interface ExecuteRequestBody {
304
305
305
306
const performCommonExecute = ( crateType : string , tests : boolean ) : ThunkAction => ( dispatch , getState ) => {
306
307
const state = getState ( ) ;
307
- const { code, configuration : { channel, mode, edition } } = state ;
308
+ const code = codeSelector ( state ) ;
309
+ const { configuration : { channel, mode, edition } } = state ;
308
310
const backtrace = state . configuration . backtrace === Backtrace . Enabled ;
309
311
310
312
if ( useWebsocketSelector ( state ) ) {
@@ -365,7 +367,8 @@ function performCompileShow(
365
367
dispatch ( request ( ) ) ;
366
368
367
369
const state = getState ( ) ;
368
- const { code, configuration : {
370
+ const code = codeSelector ( state ) ;
371
+ const { configuration : {
369
372
channel,
370
373
mode,
371
374
edition,
@@ -678,9 +681,11 @@ export function performMiri(): ThunkAction {
678
681
return function ( dispatch , getState ) {
679
682
dispatch ( requestMiri ( ) ) ;
680
683
681
- const { code, configuration : {
684
+ const state = getState ( ) ;
685
+ const code = codeSelector ( state ) ;
686
+ const { configuration : {
682
687
edition,
683
- } } = getState ( ) ;
688
+ } } = state ;
684
689
const body : MiriRequestBody = { code, edition } ;
685
690
686
691
return jsonPost < MiriResponseBody > ( routes . miri , body )
@@ -716,9 +721,11 @@ export function performMacroExpansion(): ThunkAction {
716
721
return function ( dispatch , getState ) {
717
722
dispatch ( requestMacroExpansion ( ) ) ;
718
723
719
- const { code, configuration : {
724
+ const state = getState ( ) ;
725
+ const code = codeSelector ( state ) ;
726
+ const { configuration : {
720
727
edition,
721
- } } = getState ( ) ;
728
+ } } = state ;
722
729
const body : MacroExpansionRequestBody = { code, edition } ;
723
730
724
731
return jsonPost < MacroExpansionResponseBody > ( routes . macroExpansion , body )
@@ -779,8 +786,9 @@ export function performGistSave(): ThunkAction {
779
786
return function ( dispatch , getState ) {
780
787
dispatch ( requestGistSave ( ) ) ;
781
788
789
+ const state = getState ( ) ;
790
+ const code = codeSelector ( state ) ;
782
791
const {
783
- code,
784
792
configuration : {
785
793
channel, mode, edition,
786
794
} ,
@@ -790,7 +798,7 @@ export function performGistSave(): ThunkAction {
790
798
stderr = '' ,
791
799
} ,
792
800
} ,
793
- } = getState ( ) ;
801
+ } = state ;
794
802
795
803
return jsonPost < GistResponseBody > ( routes . meta . gist , { code } )
796
804
. then ( json => dispatch ( receiveGistSaveSuccess ( { ...json , code, stdout, stderr, channel, mode, edition } ) ) ) ;
0 commit comments