Skip to content

Commit

Permalink
force cherry-pick (#29749)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews authored Feb 25, 2021
1 parent 91b9d66 commit 61bdabd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
18 changes: 18 additions & 0 deletions packages/gatsby/cache-dir/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import DevLoader from "./dev-loader"
import syncRequires from "$virtual/sync-requires"
// Generated during bootstrap
import matchPaths from "$virtual/match-paths.json"
import { LoadingIndicatorEventHandler } from "./loading-indicator"

if (process.env.GATSBY_HOT_LOADER === `fast-refresh` && module.hot) {
module.hot.accept(`$virtual/sync-requires`, () => {
Expand Down Expand Up @@ -164,6 +165,23 @@ apiRunnerAsync(`onClientEntry`).then(() => {

renderer(<Root />, 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(
<LoadingIndicatorEventHandler />,
indicatorMountElement
)
}
})
})
})
Expand Down
5 changes: 0 additions & 5 deletions packages/gatsby/cache-dir/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 { reportError, clearError } from "./error-overlay-handler"
import { LoadingIndicatorEventHandler } from "./loading-indicator"

Expand Down Expand Up @@ -148,9 +147,5 @@ const ConditionalFastRefreshOverlay = ({ children }) => {
export default () => (
<ConditionalFastRefreshOverlay>
<StaticQueryStore>{WrappedRoot}</StaticQueryStore>
{process.env.GATSBY_EXPERIMENTAL_QUERY_ON_DEMAND &&
process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true` && (
<LoadingIndicatorEventHandler />
)}
</ConditionalFastRefreshOverlay>
)

0 comments on commit 61bdabd

Please sign in to comment.