Skip to content

Commit e5d7249

Browse files
author
BryanSchroeder
committed
attempting to make polling requests not eat bandwidth
1 parent 7ba267b commit e5d7249

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

dash/dash-renderer/src/actions/callbacks.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ function handleServerside(
439439
const fetchCallback = () => {
440440
const headers = getCSRFHeader() as any;
441441
let url = `${urlBase(config)}_dash-update-component`;
442+
let new_body = body
442443

443444
const addArg = (name: string, value: string) => {
444445
let delim = '?';
@@ -447,11 +448,19 @@ function handleServerside(
447448
}
448449
url = `${url}${delim}${name}=${value}`;
449450
};
450-
if (cacheKey) {
451-
addArg('cacheKey', cacheKey);
452-
}
453-
if (job) {
454-
addArg('job', job);
451+
if (cacheKey || job) {
452+
if (cacheKey) addArg('cacheKey', cacheKey);
453+
if (job) addArg('job', job);
454+
455+
// clear inputs as background callback doesnt need inputs, just verify for context
456+
let tmp_body = JSON.parse(new_body)
457+
for (let i = 0; i < tmp_body.inputs.length; i++) {
458+
tmp_body.inputs[i]['value'] = null;
459+
}
460+
for (let i = 0; i < tmp_body?.state.length; i++) {
461+
tmp_body.state[i]['value'] = null;
462+
}
463+
new_body = JSON.stringify(tmp_body)
455464
}
456465

457466
if (moreArgs) {
@@ -464,7 +473,7 @@ function handleServerside(
464473
mergeDeepRight(config.fetch, {
465474
method: 'POST',
466475
headers,
467-
body
476+
body: new_body,
468477
})
469478
);
470479
};

0 commit comments

Comments
 (0)