Blazity / next-saas-starter

⚡️ Free Next.js responsive landing page template for SaaS products made using JAMStack architecture.
https://next-saas-starter-ashy.vercel.app/
MIT License
1.39k stars 330 forks source link

Unhandled Runtime Error Error: `schema` is required to be passed as a property to `TinaProvider`. You can learn more about this change here: https://github.com/tinacms/tinacms/pull/2823 #259

Open adamxrodriguez opened 11 months ago

adamxrodriguez commented 11 months ago

Unhandled Runtime Error Error: schema is required to be passed as a property to TinaProvider. You can learn more about this change here: https://github.com/tinacms/tinacms/pull/2823

Tried to import and find schema. no luck. not sure how the pull/2823 applies to it. there is a but no in _app.tsx

0xrotense commented 10 months ago

same error here

0xrotense commented 10 months ago

@adamxrodriguez , Are you able to get a solution to this ?

mirusky commented 9 months ago

A workaround is cleanup cookies, localstorage, etc...

Still not able to navigate to /admin but at least you can continue navigating to the site and developing

bunnypp commented 8 months ago

I was able to fix this somewhat following the instructions from here: https://tina.io/blog/upgrading-to-iframe/

  1. rename schema.ts to config.ts and replace defineSchema with defineConfig
  2. remove wrappers from pages/_app.tsx
  3. Delete pages/admin folder
  4. Access admin page at /admin/index.html

To fix the getPostsList bug, copy the [slug].tsx file from @logan-anderson's tina-fix repo.

mirusky commented 8 months ago

I'll try it later

Ostefanini commented 8 months ago

I was able to fix this somewhat following the instructions from here: https://tina.io/blog/upgrading-to-iframe/

1. rename schema.ts to config.ts and replace defineSchema with defineConfig

2. remove  wrappers from pages/_app.tsx

3. Delete pages/admin folder

4. Access admin page at /admin/index.html

To fix the getPostsList bug, copy the [slug].tsx file from @logan-anderson's tina-fix repo.

I'm trying to make it works with your instructions but no results.

For now, /admin/index.html doesn't crash anymore but it gives 404.

Here is my _app.tsx

import 'swiper/css';
import 'swiper/css/bundle';
import 'swiper/css/navigation';
import 'swiper/css/autoplay';

import { AppProps } from 'next/dist/shared/lib/router/router';
import dynamic from 'next/dynamic';
import Head from 'next/head';
import { ColorModeScript } from 'nextjs-color-mode';
import React, { PropsWithChildren } from 'react';
import { TinaEditProvider } from 'tinacms/dist/react';

import Footer from 'components/Footer';
import { GlobalStyle } from 'components/GlobalStyles';
import Navbar from 'components/Navbar';
import NavigationDrawer from 'components/NavigationDrawer';
import NewsletterModal from 'components/NewsletterModal';
import WaveCta from 'components/WaveCta';
import { NewsletterModalContextProvider, useNewsletterModalContext } from 'contexts/newsletter-modal.context';
import { NavItems } from 'types';

const navItems: NavItems = [
  { title: 'Awesome SaaS Features', href: '/features' },
  { title: 'Pricing', href: '/pricing' },
  { title: 'Contact', href: '/contact' },
  { title: 'Sign up', href: '/sign-up', outlined: true },
];

const TinaCMS = dynamic(() => import('tinacms'), { ssr: false });

function MyApp({ Component, pageProps }: AppProps) {
  return (
    <>
      <Head>
        <link rel="preconnect" href="https://fonts.googleapis.com" />
        <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
        <link rel="icon" type="image/png" href="/favicon.png" />
        {/* <link rel="alternate" type="application/rss+xml" href={EnvVars.URL + 'rss'} title="RSS 2.0" /> */}
        {/* <script
          dangerouslySetInnerHTML={{
            __html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
          ga('create', 'UA-117119829-1', 'auto');
          ga('send', 'pageview');`,
          }}
        /> */}
        {/* <script async src="https://www.google-analytics.com/analytics.js"></script> */}
      </Head>
      <ColorModeScript />
      <GlobalStyle />

      <Providers>
        <Modals />
        <Navbar items={navItems} />
{/*         <TinaEditProvider
          editMode={
            <TinaCMS
              query={pageProps.query}
              variables={pageProps.variables}
              data={pageProps.data}
              isLocalClient={!process.env.NEXT_PUBLIC_TINA_CLIENT_ID}
              branch={process.env.NEXT_PUBLIC_EDIT_BRANCH}
              clientId={process.env.NEXT_PUBLIC_TINA_CLIENT_ID}
              {...pageProps}
            >
              {(livePageProps: any) => <Component {...livePageProps} />}
            </TinaCMS>
          }
        > */}
          <Component {...pageProps} />
{/*         </TinaEditProvider>
 */}        <WaveCta />
        <Footer />
      </Providers>
    </>
  );
}

function Providers<T>({ children }: PropsWithChildren<T>) {
  return (
    <NewsletterModalContextProvider>
      <NavigationDrawer items={navItems}>{children}</NavigationDrawer>
    </NewsletterModalContextProvider>
  );
}

function Modals() {
  const { isModalOpened, setIsModalOpened } = useNewsletterModalContext();
  if (!isModalOpened) {
    return null;
  }
  return <NewsletterModal onClose={() => setIsModalOpened(false)} />;
}

export default MyApp;
bunnypp commented 7 months ago

Hi @Ostefanini,

Could you show me your [slug].tsx under pages/blog/?

sinhpn92 commented 3 months ago

I was able to fix this somewhat following the instructions from here: https://tina.io/blog/upgrading-to-iframe/

  1. rename schema.ts to config.ts and replace defineSchema with defineConfig
  2. remove wrappers from pages/_app.tsx
  3. Delete pages/admin folder
  4. Access admin page at /admin/index.html

To fix the getPostsList bug, copy the [slug].tsx file from @logan-anderson's tina-fix repo.

I have the same issue. I tried the tina-fix repo, but it's still not working with this issue. Did you resolve issue? @Ostefanini