Unverified Commit 8a513eb4 authored by Josh Story's avatar Josh Story Committed by GitHub

Update reference to workUnitStore (#70914)

prerenderStore was unified with workUnitStore before I landed random
extension. This extends the refactor to the newly landed code
parent 79bc150e
...@@ -9,24 +9,24 @@ ...@@ -9,24 +9,24 @@
import { workAsyncStorage } from '../../client/components/work-async-storage.external' import { workAsyncStorage } from '../../client/components/work-async-storage.external'
import { import {
isDynamicIOPrerender, isDynamicIOPrerender,
prerenderAsyncStorage, workUnitAsyncStorage,
} from '../app-render/prerender-async-storage.external' } from '../app-render/work-unit-async-storage.external'
import { abortOnSynchronousDynamicDataAccess } from '../app-render/dynamic-rendering' import { abortOnSynchronousDynamicDataAccess } from '../app-render/dynamic-rendering'
const originalRandom = Math.random const originalRandom = Math.random
Math.random = function random() { Math.random = function random() {
const prerenderStore = prerenderAsyncStorage.getStore() const workUnitStore = workUnitAsyncStorage.getStore()
if ( if (
prerenderStore && workUnitStore &&
prerenderStore.type === 'prerender' && workUnitStore.type === 'prerender' &&
isDynamicIOPrerender(prerenderStore) isDynamicIOPrerender(workUnitStore)
) { ) {
const workStore = workAsyncStorage.getStore() const workStore = workAsyncStorage.getStore()
const route = workStore ? workStore.route : '' const route = workStore ? workStore.route : ''
const expression = '`Math.random()`' const expression = '`Math.random()`'
if (workStore) { if (workStore) {
abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore) abortOnSynchronousDynamicDataAccess(route, expression, workUnitStore)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment