#How do you trigger getStaticPaths when reloading a dynamic route? (dev enviroment)

7 messages · Page 1 of 1 (latest)

heady moat
#

Im currently using getStaticPaths to build dynamic routes by fetching information from a CMS. When I change data in the CMS and reload (F5) the page, Astro doesn't fetch the changes so I'm stuck with a page with wrong info until I trigger an "[astro] reload" by saving the file in my editor. Is there any way of forcing getStaticPaths to trigger on page reload?

tranquil knoll
#

I think that having to save to see those changes might be something you’ll have to deal with honestly 😦

#

I just use my ctrl save as a “page reload” 🤷‍♂️

ivory flint
#

so yes and no... 😅

#

in static output, the getStaticPaths is called at build time, so when hmr does its thing it would be easier to think of it as a rebuild. But there is no way for method to know that data has changed on the CMS side, so in dev you would have to restart the server, and when you go to build you would have to do a rebuild each time there is updates the contents with the new contents on the CMS, unless they have an SDK that does that for us,

#

whereas in server mode, these are fetched on request and built on demand, so you could opt for this method and it would keep the data calls current,