relate-app / gatsby-source-strapi-graphql

A Gatsby source plugin for building websites using Strapi as a data source
BSD Zero Clause License
32 stars 9 forks source link

File System Route API return null #12

Closed mariansimecek closed 2 years ago

mariansimecek commented 2 years ago

Hi, I have a problem with gatsby and new File System Route API, it successfully generate pages by slug but graphql query output is null.

File structure: └── src ├── co-bylo │ ├── {StrapiAkce.slug}.tsx

{StrapiAkce.slug}.tsx

import React from "react"
import { graphql } from "gatsby"
const CoByloPage = ({ data }: any) => {
  console.log(data)
  return <div></div>
}

export const query = graphql`
  query TestQuery($id: String) {
    strapiAkce(slug: { eq: $id }) {
      id
      eventName
      content
      slug
    }
  }

export default CoByloPage

Console.log image

Thank you for great plugin.

timbrandin commented 2 years ago

I haven't checked out the new File System Route API, but do you get any data from the allStrapiAkce in the GraphQL explorer on http://localhost:8080/___graphql? And have you enabled preview on the plugin alternatively published the Akce document in Strapi?

mariansimecek commented 2 years ago

Yes I get data in GraphQL explorer and I have enabled preview. I tried useStaticQuery and I see data: image

timbrandin commented 2 years ago

Please check 4.4.0, there have been a number of changes since this was posted here.

mariansimecek commented 2 years ago

I checked it and it works! Thank you for great work