How does TinaCMS + Strapi + Next.js + SSG (without getServerSideProps) work?

mittonface/tina-strapi-blog is an example for how to set up TinaCMS with Strapi. But I don’t understand how it’s possible that the getServerSideProps method is not being used in this repository. For example, its pages/index.js only uses the getStaticProps method from Next.js.

It seems to me that this repository uses Next.js as a static site generator. But how is that possible together with Strapi?

In particular, I wonder if I’m right when I state: When an editor changes data in Strapi (through Strapis own web interface), then the static site won’t be re-generated with the new data.

But also besides that, what happens when data is changed through TinaCMS? Is it like this?

  1. An editor edits data through TinaCMS.
  2. TinaCMS tells Strapi to update the data.
  3. TinaCMS calls next export, that is, it tells Next.js to re-generate the static site of the website with the edited, updated data.
2 Likes

Hi @mekeor,

This is a good catch! We’ve been really focused on Git-based content storage with Tina, allowing us to defer to CI integrations set up on the Git repo for deployment. In that scenario, Tina doesn’t have to be concerned with how the website is deployed. This is not the case when you store content in a database, and we appear to have overlooked that.

The easiest way to address this, as you mentioned, would be to substitute getStaticProps for getServerSideProps (and remove getStaticPaths.) If you wanted to continue to build your pages statically, you would need to find some way to trigger your CI process after changes are saved.


The workflow you describe above is not an accurate representation of how Tina works with Strapi. While you’re editing a page, all of your changes are kept in-memory (and the demo uses react-markdown to transform markdown in the browser.)


Anyway, I hope this helps. I’ve opened an issue in the Strapi demo to explore this further.