Is there any way to use a global form with open authoring and nextjs?

I noticed in the open auth guide there it only shows the options for json and markdown forms is there a way to have a global form?

Woah sorry for the late reply @logan! There sure is, instead of registering the form with usePlugin you can instead call useFormScreenPlugin

import { usePlugin, useFormScreenPlugin } from "tinacms"

const BlogPostView = ({ file, preview }) => {
  const [data, form] = useGithubMarkdownForm(file, formOptions)

  useFormScreenPlugin(form)

  return (...)
}

@ncphi Cool seems to work well and looks awesome! only thing is the form still appears in the sidebar as will as the global screen. Any way to combat this?

Are you also using usePlugin ?

No im not. I have

 const [jsonData, jsonForm] = useNavigationForm(props.jsonFile)
  useFormScreenPlugin(jsonForm)

and useNavigationForm is just a wrapper around useGithubJsonForm just so I dont have to define the form options in the main file.

Seems like useGithubFileForm - which is used by both useGithubMarkdownForm and useGithubJsonForm - already call it:

Thanks @vNakamura! I think that’s actually a bug

@ncphi The other issue I am running into is fetching files in a global way. if we do it the traditional way with get static props, as far as I understand, that only works page to page. Any ideas of how to tackle this problem?

@logan — You could try fetching the data on the custom app file and passing it to all the page components. I haven’t done this myself but I think it will work.

@kendall The problem with that is that getStaticProps only works on a page component (don’t think the app component is a page component). After talking with nolan looks like we would have to do something.

export function getStaticProps(...) {
  const globalProps = getGlobalStaticProps(...)
  const page = getJsonStaticProps(...)
  return {
    props: {
      ...globalProps,
      ...page,
    }
  }
}

I think we can use getInitalProps in the app file but I dont think this would work well tina?

getInitialProps also only works on Page components, so my thought was that _app may be treated as a page component and you could try using getStaticProps with it. Yeah the other option would be to fetch the global data on every page :ok_hand:t3:.