From e8fe1e7333f87d7b661a258d7351ea92f54ccece Mon Sep 17 00:00:00 2001 From: Haris <4259838+Wulf@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:04:24 -0500 Subject: [PATCH] feat(qsync): undefined query string values --- create-rust-app_cli/qsync/src/hook.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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() {