{"record":{"id":"3f8c482340ef736c","repo":"sveltejs/kit","slug":"node-server-id-calling-parent-in-a-prom","errorCode":null,"errorMessage":"${node.server_id}: Calling `parent(...)` in a promise handler after `load(...)` has returned will not cause the function to re-run when parent data changes","messagePattern":"(.+?): Calling `parent\\(\\.\\.\\.\\)` in a promise handler after `load\\(\\.\\.\\.\\)` has returned will not cause the function to re-run when parent data changes","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/server/page/load_data.js","lineNumber":135,"sourceCode":"\t\t\t\t\tparams: new Proxy(event.params, {\n\t\t\t\t\t\tget: (target, key) => {\n\t\t\t\t\t\t\tif (DEV && done && typeof key === 'string' && !uses.params.has(key)) {\n\t\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t\t`${node.server_id}: Accessing \\`params.${String(\n\t\t\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\t\t)}\\` in a promise handler after \\`load(...)\\` has returned will not cause the function to re-run when the param changes`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (is_tracking) {\n\t\t\t\t\t\t\t\tuses.params.add(key);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn target[/** @type {string} */ (key)];\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t\tparent: async () => {\n\t\t\t\t\t\tif (DEV && done && !uses.parent) {\n\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t`${node.server_id}: Calling \\`parent(...)\\` in a promise handler after \\`load(...)\\` has returned will not cause the function to re-run when parent data changes`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (is_tracking) {\n\t\t\t\t\t\t\tuses.parent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn parent();\n\t\t\t\t\t},\n\t\t\t\t\troute: new Proxy(event.route, {\n\t\t\t\t\t\tget: (target, key) => {\n\t\t\t\t\t\t\tif (DEV && done && typeof key === 'string' && !uses.route) {\n\t\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t\t`${node.server_id}: Accessing \\`route.${String(\n\t\t\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\t\t)}\\` in a promise handler after \\`load(...)\\` has returned will not cause the function to re-run when the route changes`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/server/page/load_data.js#L117-L153","documentation":"`parent()` in a `load` function declares a dependency on the parent route's load data. Calling it inside a promise handler after `load` has returned means the parent dependency is registered too late, so changes to parent data will not re-run this load function. The dev warning flags the lost reactivity.","triggerScenarios":"Server `load` calls `await parent()` (or `parent().then(...)`) inside a post-return continuation when `uses.parent` is still false — i.e. parent was never awaited during the tracked portion of the body.","commonSituations":"Awaiting parent data inside nested `.then()` chains; helper functions that call `parent()` asynchronously after the load body already returned its promise.","solutions":["Call `await parent()` synchronously near the top of `load`, before other awaits that defer work.","Extract needed parent fields immediately and pass them into subsequent async logic.","Restructure helper functions so `parent()` is invoked within the tracked load body."],"exampleFix":"// before\nexport function load({ parent }) {\n  return getData().then(async (d) => ({ d, ...(await parent()) }));\n}\n// after\nexport async function load({ parent }) {\n  const p = await parent();\n  const d = await getData();\n  return { d, ...p };\n}","handlingStrategy":"validation","validationCode":"export async function load({ parent }) {\n  const parentData = await parent(); // await parent first\n  const data = await getData(parentData.userId);\n  return { data };\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always `await parent()` before any other await in a child load function.","Do not call `parent()` inside helper functions invoked from promise chains.","Keep load bodies linear: parent, then own data, then return."],"tags":["load-function","parent","sveltekit","server"],"backgroundTag":"load-deferred-parent-warning","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}