From 6bf124fb2f8ffd3909148ccc0e253c1f72f364cb Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Tue, 8 Mar 2022 14:03:33 -0800 Subject: [PATCH] remove a bad dev warning from static-build (#2733) --- .changeset/silver-foxes-bathe.md | 5 +++++ packages/astro/src/core/render/core.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/silver-foxes-bathe.md diff --git a/.changeset/silver-foxes-bathe.md b/.changeset/silver-foxes-bathe.md new file mode 100644 index 000000000..f0f63c274 --- /dev/null +++ b/.changeset/silver-foxes-bathe.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Remove a bad dev warning diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index 7ff17de70..72876b690 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -28,8 +28,11 @@ async function getParamsAndProps(opts: GetParamsAndPropsOptions): Promise<[Param } } let routeCacheEntry = routeCache.get(route); + // During build, the route cache should already be populated. + // During development, the route cache is filled on-demand and may be empty. + // TODO(fks): Can we refactor getParamsAndProps() to receive routeCacheEntry + // as a prop, and not do a live lookup/populate inside this lower function call. if (!routeCacheEntry) { - warn(logging, 'routeCache', `Internal Warning: getStaticPaths() called twice during the build. (${route.component})`); routeCacheEntry = await callGetStaticPaths(mod, route, true, logging); routeCache.set(route, routeCacheEntry); }