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

[v2] Remove SSR #101

Merged
merged 10 commits into from May 20, 2021
Merged

[v2] Remove SSR #101

merged 10 commits into from May 20, 2021

Conversation

nandorojo
Copy link
Owner

@nandorojo nandorojo commented May 19, 2021

Close #100

Breaking Changes

  • If you are using SSR, you can pass ssr={true} to DripsyProvider. In this case, it'll delay rendering until the app mounts. If you already have a gate of your own, then this isn't needed.
  • I'm removing the already-deprecated ThemeProvider.
  • The style prop will no longer be themed. This will let you use style to pass raw styles. This prop being themed was undocumented, and never recommended over sx, so this shouldn't be a problem.

SEO Recommendations

If you use custom meta tags for SEO, such as next-seo, don't make them the children of DripsyProvider. Instead, place them before the provider.

I achieve this in Next.js by 1) passing an seo object from getStaticProps to my page props, and then 2) in pages/_app.js, I render <NextSeo {...pageProps.seo} /> outside of my provider

  1. In my Next page
// pages/artist.tsx

export default function ArtistPage() {
  return <Screen />
}

export const getStaticProps = async ({ params }) => {
  const artist = await getArtist(params.slug)
  return {
    props: {
      // this will get passed to pageProps
      seo: { title: artist.name }
    },
    revalidate: 1
  }
}

And then use the seo it returns here:

// pages/_app.tsx
import NextSeo from 'next-seo'

export default function App({ Component, pageProps }) {
  return (
    <>
      {/* place this outside of the provider */}
      {pageProps.seo && <NextSeo {...pageProps.seo} />}
      <DripsyProvider ssr theme={theme}>
        <Component {...pageProps} />
      </DripsyProvider>
    </>
  )
}

@nandorojo nandorojo changed the title Remove SSR [v2] Remove SSR May 19, 2021
@nandorojo
Copy link
Owner Author

Major version bump, to v2.

Please test with yarn add dripsy@canary

@nandorojo nandorojo mentioned this pull request May 19, 2021
@nandorojo
Copy link
Owner Author

nandorojo commented May 20, 2021

Okay, I'm certainly experiencing some issues with this on web. Need to figure out why.

Update: fixed

@nandorojo
Copy link
Owner Author

Lol, just kidding. I was using px strings in my theme.breakpoints. Since we never had custom breakpoints before, this never mattered. Took that out, and all good now.

@nandorojo
Copy link
Owner Author

I'll likely merge this today. All working great for me.

@nandorojo
Copy link
Owner Author

Added validation for breakpoints in your theme

@nandorojo
Copy link
Owner Author

Deprecated webContainerSx. Perhaps my favorite commit ever. Might add an error message for it too.

🤯

@nandorojo
Copy link
Owner Author

Updated docs & example for Next.js apps. Should be ready to go. Will test a few more hours then merge.

@nandorojo nandorojo merged commit ca259ce into master May 20, 2021
@nandorojo
Copy link
Owner Author

v2 published (2.0.1)

yarn add dripsy

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 this pull request may close these issues.

Dropping SSR support
1 participant