atlassian-labs / react-resource-router

Configuration driven routing solution for React SPAs that manages route matching, data fetching and progressive rendering
https://atlassian-labs.github.io/react-resource-router
Apache License 2.0
198 stars 28 forks source link

Feature/add lru cache #96

Closed prithveeshgoel closed 3 years ago

prithveeshgoel commented 3 years ago

In cleanExpiredResources the slice for the key to be deleted was getting fetched from getSliceForResource which would create a slice if it is not present in the state for that particular type. This was creating an issue as calling deleteResourceKey when type is not available in data would create a null exception. In this PR added a check if type & key exist in state only then delete the key from state.