Skip to content

Stripping Input Data from Background Callback Polling #3113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 25, 2025
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 newBody = body;

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 tmpBody = JSON.parse(newBody);
for (let i = 0; i < tmpBody.inputs.length; i++) {
tmpBody.inputs[i]['value'] = null;
}
for (let i = 0; i < (tmpBody?.state || []).length; i++) {
tmpBody.state[i]['value'] = null;
}
newBody = JSON.stringify(tmpBody);
}

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