Skip to content

Commit

Permalink
Merge pull request #94 from hydrostack/improve-model-serialization
Browse files Browse the repository at this point in the history
Make sure that the `undefined` values are sent as null. Make sure we …
  • Loading branch information
kjeske authored Oct 1, 2024
2 parents e0fe889 + 4be5028 commit b2e724c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Scripts/hydro.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@
requestForm.append('__hydro_type', type);

if (requestData.parameters) {
requestForm.append('__hydro_parameters', JSON.stringify(requestData.parameters))
const paramsData = JSON.stringify(requestData.parameters, (k, v) => v === undefined ? null : v);
requestForm.append('__hydro_parameters', paramsData)
}

if (requestData.eventData) {
Expand Down Expand Up @@ -435,7 +436,7 @@
from.checked = to.checked;
}

if (from.tagName === "INPUT" && ['password', 'text', 'number', 'date', 'email'].includes(from.type) && from.value !== to.getAttribute("value")) {
if ((from.tagName === "SELECT" || (from.tagName === "INPUT" && ['password', 'text', 'number', 'date', 'email'].includes(from.type))) && from.value !== to.value) {
if (document.activeElement === from) {
if (morphActiveElement && from.value !== to.value) {
from.value = to.value;
Expand Down

0 comments on commit b2e724c

Please sign in to comment.