Skip to content

Conversation

cesar-tonnoir
Copy link

Context:

Cachememory.removeResource is executed whenever a resource gets deleted.

This method aims to remove the deleted resource from the collections persisted in service cache.

Bug:

Resources that aren't directly related to the deleted resource get removed from the cache as well.

After investigation, we've found out this is caused by the removeResource method that loops over all the available collections, and removes one item every time, whether or not the target resource has been found.

This seems to be caused by the use of the splice method chained with findIndex : findIndex returns -1 when the resource isn't found, and splice removes the last item of the array.

Resolution:

If findIndex returns -1, avoid calling splice

@cesar-tonnoir
Copy link
Author

Hey @pablorsk, what do you think of this one?

I'm struggling to test locally as I can't manage to find a way to build the lib and link it to my project.
Any tip ?

Cheers,
Cesar.

@cesar-tonnoir
Copy link
Author

cesar-tonnoir commented Jan 13, 2021

@pablorsk any news ?
thanks

@veneliniliev
Copy link

@pablorsk please merge this and release update!!!

@veneliniliev
Copy link

@cesar-tonnoir did you find a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants