// a settled promise runs {:then} in its own batch, which sees the old data and page while a navigation lands
const readsRouteState =
"Identifier[name=/^(data|page)$/]:not(MemberExpression > Identifier.property, Property > Identifier.key)";
export const staleAwait = ["Pending", "Then", "Catch"].map((branch) => ({
selector: `SvelteAwait${branch}Block:has(${readsRouteState})`,
message:
"{#await} branches can run before a navigation lands, seeing the old data and page. await in a <Pending> instead: {@const value = await ...}."
}));