Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): always use publicLoader for window.___loader #16122

Merged
merged 5 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/gatsby/cache-dir/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import domReady from "@mikaelkristiansson/domready"
import socketIo from "./socketIo"
import emitter from "./emitter"
import { apiRunner, apiRunnerAsync } from "./api-runner-browser"
import { setLoader } from "./loader"
import { setLoader, publicLoader } from "./loader"
import DevLoader from "./dev-loader"
import syncRequires from "./sync-requires"
// Generated during bootstrap
Expand All @@ -17,6 +17,8 @@ const loader = new DevLoader(syncRequires, matchPaths)
setLoader(loader)
loader.setApiRunner(apiRunner)

window.___loader = publicLoader

// Let the site/plugins run code very early.
apiRunnerAsync(`onClientEntry`).then(() => {
// Hook up the client to socket.io on server
Expand Down
1 change: 0 additions & 1 deletion packages/gatsby/cache-dir/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ export const publicLoader = {
prefetch: rawPath => instance.prefetch(rawPath),
isPageNotFound: rawPath => instance.isPageNotFound(rawPath),
hovering: rawPath => instance.hovering(rawPath),
findMatchPath: rawPath => instance.findMatchPath(rawPath),
}

export default publicLoader
1 change: 0 additions & 1 deletion packages/gatsby/cache-dir/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ function init() {
// Temp hack while awaiting https://github.com/reach/router/issues/119
window.__navigatingToLink = false

window.___loader = loader
window.___push = to => navigate(to, { replace: false })
window.___replace = to => navigate(to, { replace: true })
window.___navigate = (to, options) => navigate(to, options)
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/cache-dir/production-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import emitter from "./emitter"
import PageRenderer from "./page-renderer"
import asyncRequires from "./async-requires"
import { setLoader, ProdLoader } from "./loader"
import { setLoader, ProdLoader, publicLoader } from "./loader"
import EnsureResources from "./ensure-resources"
import stripPrefix from "./strip-prefix"

Expand All @@ -25,7 +25,7 @@ loader.setApiRunner(apiRunner)

window.asyncRequires = asyncRequires
window.___emitter = emitter
window.___loader = loader
window.___loader = publicLoader
window.___webpackCompilationHash = window.webpackCompilationHash

navigationInit()
Expand Down