Remove service worker, fix rendering
This commit is contained in:
parent
c4f5133531
commit
9224378866
|
@ -72,7 +72,6 @@ module.exports = {
|
|||
resolve: `gatsby-source-filesystem`,
|
||||
options: {
|
||||
name: `watcher`,
|
||||
// In dev mode, watch all the source files. Otherwise, point it at a meaningless directory
|
||||
path: `${__dirname}/.cache/gatsby-source-git/`,
|
||||
}
|
||||
},
|
||||
|
@ -164,5 +163,14 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
`gatsby-plugin-remove-serviceworker`,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// {
|
||||
// resolve: `gatsby-plugin-offline`,
|
||||
// options: {
|
||||
// precachePages: [`/en/4/developer_guides/**`],
|
||||
// },
|
||||
// }
|
||||
>>>>>>> Remove service worker, fix rendering
|
||||
],
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const React = require('react');
|
||||
const Layout = require('./src/components/Layout').default;
|
||||
const NodeProvider = require('./src/components/NodeProvider').default;
|
||||
const { setCurrentPath } = require('./src/utils/nodes');
|
||||
|
||||
/**
|
||||
* Applies the node provider (static query of all documents)
|
||||
|
@ -16,7 +17,7 @@ exports.wrapPageElement = ({ element, props }) => {
|
|||
);
|
||||
};
|
||||
|
||||
exports.onRenderBody = ({ setPostBodyComponents, setHeadComponents }) => {
|
||||
exports.onRenderBody = ({ setPostBodyComponents, setHeadComponents, pathname }) => {
|
||||
// Rules that cannot be touched by purgecss because they come in from client side rendering
|
||||
setHeadComponents([
|
||||
<style key='prism-css' type="text/css" dangerouslySetInnerHTML={{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { StatelessComponent, useState, useEffect, ReactNode } from "react";
|
||||
import React, { StatelessComponent, useState, ReactNode } from "react";
|
||||
import Header from './Header';
|
||||
import Sidebar from './Sidebar';
|
||||
import useHierarchy from '../hooks/useHierarchy';
|
||||
|
@ -9,11 +9,13 @@ interface LayoutProps {
|
|||
slug: string;
|
||||
}
|
||||
}
|
||||
const Layout: StatelessComponent<LayoutProps> = ({ children }) => {
|
||||
const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug } }) => {
|
||||
const { setCurrentPath } = useHierarchy();
|
||||
const [isToggled, setSidebarOpen] = useState(false);
|
||||
const handleNavigate = () => setSidebarOpen(false);
|
||||
|
||||
setCurrentPath(slug);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header handleSidebarToggle={() => setSidebarOpen(!isToggled)} />
|
||||
|
|
|
@ -56,6 +56,7 @@ const NodeProvider: StatelessComponent<{}> = ({ children, pageContext: { slug }
|
|||
getNodes,
|
||||
getParent,
|
||||
getSiblings,
|
||||
setCurrentPath,
|
||||
}}>
|
||||
{children}
|
||||
</NodeContext.Provider>
|
||||
|
|
|
@ -12,7 +12,7 @@ interface NodeFunctions {
|
|||
getHomePage(): SilverstripeDocument|null;
|
||||
getNavChildren(node: SilverstripeDocument): SilverstripeDocument[];
|
||||
getCurrentVersion(): string;
|
||||
setCurrentNode(slug: string): undefined;
|
||||
setCurrentPath(slug: string): undefined;
|
||||
};
|
||||
|
||||
const useHierarchy = (): NodeFunctions => {
|
||||
|
|
|
@ -5,11 +5,11 @@ import { SingleFileQuery } from '../types';
|
|||
|
||||
const Template: StatelessComponent<SingleFileQuery> = (result): ReactElement => {
|
||||
const currentNode = result.data.silverstripeDocument;
|
||||
const { title, slug } = currentNode;
|
||||
const { title } = currentNode;
|
||||
const { html } = currentNode.watchFile;
|
||||
const { relativePath, gitRemote } = currentNode.parent.parent;
|
||||
const { ref, href } = gitRemote;
|
||||
console.log('rendering the template for ', slug, html.substring(0, 25));
|
||||
|
||||
return (
|
||||
<DocsPage
|
||||
title={title}
|
||||
|
|
Loading…
Reference in New Issue