Skip to content

Commit

Permalink
update netlify runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Apr 11, 2023
1 parent 322cfa7 commit d3729e3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/runtime/entries/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ export const handler: Handler = async function handler(event, context) {
const url = withQuery(event.path, query);
const routeRules = getRouteRulesForPath(url);

if (routeRules.cache && (routeRules.cache.swr || routeRules.cache.static)) {
if (routeRules.isr) {
const builder = await import("@netlify/functions").then(
(r) => r.builder || r.default.builder
);
const ttl =
typeof routeRules.cache.swr === "number" ? routeRules.cache.swr : 60;
const swrHandler = routeRules.cache.swr
const ttl = typeof routeRules.isr === "number" ? routeRules.isr : false;
const builderHandler = ttl
? (((event, context) =>
lambda(event, context).then((r) => ({ ...r, ttl }))) as Handler)
: lambda;
return builder(swrHandler)(event, context) as any;
return builder(builderHandler)(event, context) as any;
}

return lambda(event, context);
Expand Down

0 comments on commit d3729e3

Please sign in to comment.