title: How to clear NextJs GetStaticPaths cache / "unpublish" a dynamic route?
body: <p>I think this is quite a vanilla question but I can't find anything on Google.</p>
  <p>I'm learning NextJs (using TypeScript) and I've got a site successfully working with dynamic routes, SSR, and incremental regeneration all setup and deployed to Vercel. Here's an example of the <code>GetStaticProps</code> and <code>GetStaticPaths</code> code in my dynamic route handler:</p>
  <pre><code>export const getStaticPaths: GetStaticPaths = async () =&gt; {
      const routes = new CmsHelper().GetRoutes();
  
      const paths = (await routes).items.map((item, index, items) =&gt; {
          return item.fields.urlPath;
      })
  
      return {
          paths: paths,
          fallback: 'blocking',
      };
  }
  
  export const getStaticProps: GetStaticProps = async (context) =&gt; {
      const urlParts = context.params?.url as string[] || [];
      const urlPath = `/${urlParts.join('/')}`;
      const article = await new CmsHelper().GetArticle(urlPath);
      return {
          props: {
              article
          },
          revalidate: 10,
      }
  }
  </code></pre>
  <p>If I request a <em>new</em> path that was published in the cms after build time, it successfully regenerates on the server and returns the page.</p>
  <p>So far so good.</p>
  <p>However, if I <em>unpublish</em> a route in my CMS... it is still returned by the app, unless I rebuild and redeploy (or otherwise cause the process to restart, in dev).</p>
  <p>So my question is: how do I dynamically cause NextJs to remove a dynamic route from its GetStaticPaths cache?</p>
  <p>I understand that <code>GetStaticProps</code> is going to be called at most once every 10 seconds because of the <code>revalidate</code> configuration. But as far as I know, <code>GetStaticPaths</code> will only be called if a request comes in from a route that is not currently cached(?)</p>
  <p>In other words, for an integration with a headless CMS, how can I support <em>unpublishing or renaming</em> pages with NextJs without triggering a rebuild/deploy?</p>
  <p>Thanks in advance!</p>