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

Maximum update depth exceeded. #3

Open
philip-akerfeldt opened this issue Oct 30, 2019 · 1 comment · May be fixed by #4
Open

Maximum update depth exceeded. #3

philip-akerfeldt opened this issue Oct 30, 2019 · 1 comment · May be fixed by #4

Comments

@philip-akerfeldt
Copy link

Hi! I tried to set up your plugin but i encountered some issues. It happens when as soon as the page loads where the component is present.

This is the error i receive:
Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render. in SearchComponent (at HeaderSearchbar.tsx:10) in StaticQueryDataRenderer (at gatsby-browser-entry.js:38)

And this is my current setup:

import React from 'react'
import { StaticQuery, graphql, navigate } from 'gatsby'
import Search from 'gatsby-wordpress-search'

const HeaderSearchbar = () => (
  <StaticQuery
    query={graphql`
      {
        allWordpressWpSearchResults {
          edges {
            node {
              id
              post_title
              searchData
              pathname
            }
          }
        }
      }
    `}
    render={data => {
      return (
        <Search
          data={data}
          minCharacters={4}
          contentCharacters={300}
          maxResults={10}
          placeholder="Search"
          onSelect={object => navigate(o.pathname)}
        />
      )
    }}
  />
)

export default HeaderSearchbar

Any ideas of what could be causing this issue?

@D19cannon
Copy link

Same problem. Repo is probably dead. Decided to create my own instead.

@nickmcmillan nickmcmillan linked a pull request Apr 29, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants