diff --git a/packages/gatsby/cache-dir/app.js b/packages/gatsby/cache-dir/app.js
index 97025aac14ff7..3676dd72be5e0 100644
--- a/packages/gatsby/cache-dir/app.js
+++ b/packages/gatsby/cache-dir/app.js
@@ -12,6 +12,7 @@ import DevLoader from "./dev-loader"
import asyncRequires from "$virtual/async-requires"
// Generated during bootstrap
import matchPaths from "$virtual/match-paths.json"
+import { LoadingIndicatorEventHandler } from "./loading-indicator"
// ensure in develop we have at least some .css (even if it's empty).
// this is so there is no warning about not matching content-type when site doesn't include any regular css (for example when css-in-js is used)
@@ -168,6 +169,23 @@ apiRunnerAsync(`onClientEntry`).then(() => {
renderer(, rootElement, () => {
apiRunner(`onInitialClientRender`)
+
+ // Render query on demand overlay
+ if (
+ process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR &&
+ process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true`
+ ) {
+ const indicatorMountElement = document.createElement(`div`)
+ indicatorMountElement.setAttribute(
+ `id`,
+ `query-on-demand-indicator-element`
+ )
+ document.body.append(indicatorMountElement)
+ ReactDOM.render(
+ ,
+ indicatorMountElement
+ )
+ }
})
})
})
diff --git a/packages/gatsby/cache-dir/root.js b/packages/gatsby/cache-dir/root.js
index 1e3fb8c2674fe..95e541de4084b 100644
--- a/packages/gatsby/cache-dir/root.js
+++ b/packages/gatsby/cache-dir/root.js
@@ -12,7 +12,6 @@ import loader from "./loader"
import { PageQueryStore, StaticQueryStore } from "./query-result-store"
import EnsureResources from "./ensure-resources"
import FastRefreshOverlay from "./fast-refresh-overlay"
-import { LoadingIndicatorEventHandler } from "./loading-indicator"
navigationInit()
@@ -116,9 +115,5 @@ const WrappedRoot = apiRunner(
export default () => (
{WrappedRoot}
- {process.env.GATSBY_EXPERIMENTAL_QUERY_ON_DEMAND &&
- process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true` && (
-
- )}
)