title: Next.js: conditionally call getServerSideProps
body: <p>I'm trying to conditionally SSR a Next page and the lack of answers on the internet with a similar scenario as me lead me to believe my understanding of NextJS and SSR altogether is slightly incorrect, so I would love some clarification.</p>
  <p><strong>Here is my understanding</strong>: having the function <code>getServerSideProps</code> exported in our page file tells Next that we want to SSR said page and pass server-fetched data to our page. Therefore, if I want to conditionally SSR this page, I need to only call <code>getServerSideProps</code> <em>sometimes</em>. After some research, I thought that using the <a href="https://nextjs.org/docs/advanced-features/dynamic-import" rel="nofollow noreferrer">Dynamic Import</a> from <code>next/dynamic</code> would solve this problem, as you're able to conditionally apply SSR, however, it appears that even when I wrap my page component in the <code>dynamic</code> function (as specified <a href="https://stackoverflow.com/questions/53139884/next-js-disable-server-side-rendering-on-some-pages">Here</a>), <code>getServerSideProps</code> is still being called.</p>
  <p><strong>Here is my desired functionality</strong>: I want to only SSR a page if my client cache does not already contain the data required by that page. In other words, I want to first check if the client cache contains the data required by the page, and if it does, use the data to render that page, and if it does not, I would then like to perform SSR and get said data in <code>getServerSideProps</code>.</p>
  <p>Is this even possible? Or is my understanding of the framework incorrect?</p>
  <p>Any clarification or advice would be greatly appreciated!</p>