#Prevent subsequent GET requests

1 messages · Page 1 of 1 (latest)

slender quarry
#

I am using useFetcher to submit a form. It submits to an API route and from there to an external API. If the external API returns a status 422, I return the following response to the fetcher from the API route:

    status: 422,
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8',
    }    
  });  ```

In the browser inspector I can see that the status 422 is being returned to the fetcher, however Remix is still doing the additional GET requests after. Any ideas what I'm doing wrong?.. thanks.
brave gyro
#

Remix always revalidate the loaders of every matching route

#

you can export a shouldRevalidate function from the route to customize this behavior on a per-page basis

slender quarry
#

Hi, thanks for your response.. I was reading from here: https://github.com/remix-run/remix/issues/3069. that the React Router 6.4+ meant that responses with errors status wouldn't revalidate the loaders.. but perhaps it means I need to use the shouldRevalidate.

GitHub

Build Better Websites. Create modern, resilient user experiences with web fundamentals. - Issues · remix-run/remix

brave gyro