diff --git a/create-rust-app_cli/qsync/src/hook.rs b/create-rust-app_cli/qsync/src/hook.rs index eadd437e..30fa6c05 100644 --- a/create-rust-app_cli/qsync/src/hook.rs +++ b/create-rust-app_cli/qsync/src/hook.rs @@ -103,7 +103,10 @@ impl Hook { } if !self.query_params.is_empty() { - variables.push_str(" const queryParams: Record = Object.assign({}, "); + variables.push_str( + " // we use JSON.parse(JSON.stringify()) to remove nested undefined values\n", + ); + variables.push_str(" const queryParams: Record = JSON.parse(JSON.stringify(Object.assign({}, "); let query_param_iter = self.query_params.iter(); for (index, param) in query_param_iter.clone().enumerate() { let is_primitive_type = is_primitive_type(param.hook_arg_type.clone()); @@ -126,7 +129,7 @@ impl Hook { variables.push_str(", "); } } - variables.push_str(")\n"); + variables.push_str(")))\n"); } if !self.path_params.is_empty() {