File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ import {
127127 setUpdatePlannedHomePositionFromLoadModal ,
128128} from "../slices/missionSlice"
129129import {
130+ emitRefreshParams ,
130131 resetParamsWriteProgressData ,
131132 setAutoPilotRebootModalOpen ,
132133 setFetchingParam ,
@@ -938,6 +939,24 @@ const socketMiddleware = (store) => {
938939 if ( rebootRequired ) {
939940 store . dispatch ( setRebootPromptModalOpen ( true ) )
940941 }
942+
943+ // Refresh params if an _ENABLE param has been changed
944+ const hasEnableParam = paramsSetSuccessfully . some ( ( param ) =>
945+ String ( param ?. param_id || "" )
946+ . toUpperCase ( )
947+ . endsWith ( "_ENABLE" ) ,
948+ )
949+ const isOnParamsPage =
950+ store . getState ( ) . droneConnection . currentPage === "params"
951+ const isAlreadyFetching = store . getState ( ) . paramsSlice . fetchingVars
952+
953+ if ( hasEnableParam && isOnParamsPage && ! isAlreadyFetching ) {
954+ store . dispatch (
955+ setFetchingVarsProgress ( { progress : 0 , param_id : "" } ) ,
956+ )
957+ store . dispatch ( setFetchingVars ( true ) )
958+ store . dispatch ( emitRefreshParams ( ) )
959+ }
941960 } )
942961
943962 socket . socket . on ( ParamSpecificSocketEvents . onParamError , ( msg ) => {
You can’t perform that action at this time.
0 commit comments