react-openapi-client
react-openapi-client copied to clipboard
Retry When Init Fails
When the client instantiates the server offline, connection will never be established. Currently, in the code you catch the error, but do nothing with it. It would be nice, if that would update automatically when going online.
Therefore, I suggest to add a timer with a retry timer given in the properties (with some meaningful default, e.g. 5000ms). It could retry not only on initSyng (when reading the JSON definition), but also if a request fails.
e.g.
const App = () => (
<OpenAPIProvider retry="5000" definition="http://petstore.swagger.io:8080/api/v3/openapi.json">
<PetDetails id={1} />
</OpenAPIProvider>
)