Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delegate decorator not removing function from map #75

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

notanengineercom
Copy link
Contributor

Hey! First of all, really cool library 😄
It seems like the map in the delegate decorator is acting like a permanent cache for the method to delegate. So even after the promise is resolved, the first result is being returned when calling the method with delegation again afterwards. I think this is not the expected behaviour according to the docs:

For a given input, if within the time period of the resolving of the promise of the first invocation the decorated method was invoked multiple times (with the same input) the response would be the promise that was generated by the first invocation.

This pr should fix the issue. I added a test in the spec to verify it!

As a sidenote, I would recommend you running npm version x.x.x instead of updating the value mannually. It changes the version both on the package and package-lock files. When I npm installed the library locally, package-lock.json was modified automatically because of this.

@vlio20
Copy link
Owner

vlio20 commented Apr 9, 2020

Thanks @notanengineercom, you are totally right, I missed that!
Regarding the npm release note, you are probably right I will remove that from the release script.

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.

2 participants