fix: keep ui state consistent with the original request model when scripts are run

This commit is contained in:
Udhay-Adithya
2025-07-01 20:03:22 +05:30
parent e5b22a24fc
commit 737aac96ec

View File

@@ -281,9 +281,10 @@ class CollectionStateNotifier
return; return;
} }
if (requestModel != null && RequestModel executionRequestModel = requestModel!;
!requestModel.preRequestScript.isNullOrEmpty()) {
requestModel = await handlePreRequestScript( if (!requestModel.preRequestScript.isNullOrEmpty()) {
executionRequestModel = await handlePreRequestScript(
requestModel, requestModel,
originalEnvironmentModel, originalEnvironmentModel,
(envModel, updatedValues) { (envModel, updatedValues) {
@@ -298,9 +299,9 @@ class CollectionStateNotifier
); );
} }
APIType apiType = requestModel!.apiType; APIType apiType = executionRequestModel.apiType;
HttpRequestModel substitutedHttpRequestModel = HttpRequestModel substitutedHttpRequestModel =
getSubstitutedHttpRequestModel(requestModel.httpRequestModel!); getSubstitutedHttpRequestModel(executionRequestModel.httpRequestModel!);
// set current model's isWorking to true and update state // set current model's isWorking to true and update state
var map = {...state!}; var map = {...state!};