gilbarbara/react-inlinesvg

Do not cache a failed get request

ssmereka opened this issue · 6 comments

Just an idea for an enhancement. Currently when setting cacheGetRequests to true a get request is only ever tried once. To handle poor network connectivity and retries you could change this to when cacheGetRequests is true the request is only ever tried once if it was successful.

Hey

There is a new version with support for title, description and custom props and an updated cache system.
Can you please try it? npm i react-inlinesvg@next
There are a few changes in props, you can check it here

Hi @ssmereka & @gilbarbara ,

I have implemented the following feature request here: #113.

The main push for this pull request was to actually resolve a bug I believe I’ve found in the next branch.

I'm not sure if it's exactly a bug or an intended feature... but I’ve added what I think would be favorable for many developer’s use cases.

@ssmereka @Joroze
I've refactored the cache system to immediately cache requests and exclude failed requests.
You can try it with:

npm i react-inlinesvg@next

@gilbarbara You should refactor the cache system from Array to Dictionary next to achieve that O(1) satisfactory 👍

@Joroze Done! 🚀

v1.0.0 released! 🎉