Skip to content
21 changes: 15 additions & 6 deletions dash/dash-renderer/src/actions/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ function handleServerside(
const fetchCallback = () => {
const headers = getCSRFHeader() as any;
let url = `${urlBase(config)}_dash-update-component`;
let new_body = body;
Comment thread
T4rk1n marked this conversation as resolved.
Outdated

const addArg = (name: string, value: string) => {
let delim = '?';
Expand All @@ -447,11 +448,19 @@ function handleServerside(
}
url = `${url}${delim}${name}=${value}`;
};
if (cacheKey) {
addArg('cacheKey', cacheKey);
}
if (job) {
addArg('job', job);
if (cacheKey || job) {
if (cacheKey) addArg('cacheKey', cacheKey);
if (job) addArg('job', job);

// clear inputs as background callback doesnt need inputs, just verify for context
const tmp_body = JSON.parse(new_body);
Comment thread
T4rk1n marked this conversation as resolved.
Outdated
for (let i = 0; i < tmp_body.inputs.length; i++) {
tmp_body.inputs[i]['value'] = null;
}
for (let i = 0; i < (tmp_body?.state || []).length; i++) {
tmp_body.state[i]['value'] = null;
}
new_body = JSON.stringify(tmp_body);
}

if (moreArgs) {
Expand All @@ -464,7 +473,7 @@ function handleServerside(
mergeDeepRight(config.fetch, {
method: 'POST',
headers,
body
body: new_body
})
);
};
Expand Down