MCPcopy
hub / github.com/vercel/next.js / executeRevalidates

Function executeRevalidates

packages/next/src/server/revalidation-utils.ts:186–221  ·  view source on GitHub ↗
(
  workStore: WorkStore,
  state?: RevalidationState
)

Source from the content-addressed store, hash-verified

184}
185
186export function executeRevalidates(
187 workStore: WorkStore,
188 state?: RevalidationState
189): false | Promise<void> {
190 const promises: Promise<unknown>[] = []
191
192 const pendingRevalidatedTags =
193 state?.pendingRevalidatedTags ?? workStore.pendingRevalidatedTags ?? []
194
195 if (pendingRevalidatedTags.length > 0) {
196 promises.push(
197 revalidateTags(
198 pendingRevalidatedTags,
199 workStore.incrementalCache,
200 workStore
201 )
202 )
203 }
204
205 const pendingRevalidates = Object.values(
206 state?.pendingRevalidates ?? workStore.pendingRevalidates ?? {}
207 )
208
209 promises.push(...pendingRevalidates)
210
211 const pendingRevalidateWrites =
212 state?.pendingRevalidateWrites ?? workStore.pendingRevalidateWrites ?? []
213
214 promises.push(...pendingRevalidateWrites)
215
216 if (promises.length === 0) {
217 return false
218 }
219
220 return Promise.all(promises).then(() => undefined)
221}

Callers 5

renderToHTMLOrFlightImplFunction · 0.90
handleActionFunction · 0.90
withExecuteRevalidatesFunction · 0.85

Calls 5

revalidateTagsFunction · 0.85
thenMethod · 0.80
allMethod · 0.80
pushMethod · 0.65
valuesMethod · 0.45

Tested by

no test coverage detected