Skip to content

Commit

Permalink
fix: Missing location prop
Browse files Browse the repository at this point in the history
  • Loading branch information
zanechua committed Oct 10, 2020
1 parent d5287cf commit 20e81b8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/pages/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from "react";

import Layout from "../components/layout";
import SEO from "../components/seo";
import PropTypes from 'prop-types';

function NotFoundPage() {
function NotFoundPage({ location }) {
return (
<Layout>
<SEO
Expand All @@ -19,4 +20,9 @@ function NotFoundPage() {
);
}

NotFoundPage.propTypes = {
location: PropTypes.object,
};


export default NotFoundPage;
8 changes: 7 additions & 1 deletion src/pages/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from "react";

import Layout from "../components/layout";
import SEO from "../components/seo";
import PropTypes from 'prop-types';

function AboutPage() {
function AboutPage({ location }) {
return (
<Layout>
<SEO
Expand All @@ -22,4 +23,9 @@ function AboutPage() {
);
}

AboutPage.propTypes = {
location: PropTypes.object,
};


export default AboutPage;
3 changes: 2 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PropTypes from 'prop-types';

import { graphql } from "gatsby"

const IndexPage = ({ data: { allMarkdownRemark: { edges } }}) => {
const IndexPage = ({ data: { allMarkdownRemark: { edges } }, location}) => {
const Posts = edges
.filter(edge => !!edge.node.frontmatter.date) // You can filter your posts based on some criteria
.map(edge => <PostLink key={edge.node.id} post={edge.node} />)
Expand All @@ -32,6 +32,7 @@ const IndexPage = ({ data: { allMarkdownRemark: { edges } }}) => {
}

IndexPage.propTypes = {
location: PropTypes.object,
data: PropTypes.shape({
allMarkdownRemark: PropTypes.shape({
edges: PropTypes.array
Expand Down
8 changes: 7 additions & 1 deletion src/pages/lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React from "react";

import Layout from "../components/layout";
import SEO from "../components/seo";
import PropTypes from 'prop-types';
import {Link} from 'gatsby';

function LabPage() {
function LabPage({ location }) {
return (
<Layout>
<SEO
Expand Down Expand Up @@ -132,4 +133,9 @@ function LabPage() {
);
}

LabPage.propTypes = {
location: PropTypes.object,
};


export default LabPage;
10 changes: 8 additions & 2 deletions src/pages/lab/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from "react";

import Layout from "../../components/layout";
import SEO from "../../components/seo";
import PropTypes from 'prop-types';

function LabPage() {
function LabCatalogPage({ location }) {
return (
<Layout>
<SEO
Expand Down Expand Up @@ -112,4 +113,9 @@ function LabPage() {
);
}

export default LabPage;
LabCatalogPage.propTypes = {
location: PropTypes.object,
};


export default LabCatalogPage;
2 changes: 1 addition & 1 deletion src/templates/blog-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import CommentSection from '../components/comment-section';
import CommentForm from '../components/comment-form';

// the data prop will be injected by the GraphQL query below.
const Template = ({ data }) => {
const Template = ({ data, location }) => {
const { posts, comments } = data // data.posts holds your post data
const { frontmatter, excerpt, html } = posts;

Expand Down

0 comments on commit 20e81b8

Please sign in to comment.