Skip to content
This repository was archived by the owner on Jun 15, 2020. It is now read-only.
This repository was archived by the owner on Jun 15, 2020. It is now read-only.

addUrlProps cached handlers #68

@koshkarik

Description

@koshkarik

Do you want to request a feature or report a bug?
bug

What is the current behavior?
We use addUrlProps function in one of our components (it acts like filter by pushing attributes to url query). So when the component mounts for the first time - some handlers are stored in cache https://github.com/pbeshai/react-url-query/blob/master/src/react/addUrlProps.js#L223 and they are pointing to current instance https://github.com/pbeshai/react-url-query/blob/master/src/react/addUrlProps.js#L220.
I apply some filters (query attributes are added to url). Then i go to some other section in our application, after that i come back.
And already existing handlers from the cache get access to previous instance https://github.com/pbeshai/react-url-query/blob/master/src/react/addUrlProps.js#L180 . And this.props.location contains old irrelevant data and it gets pushed to url query.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.

What is the expected behavior?
I think cashedHandlers should be cleared on unmount.

Which versions of react-url-query, and which browser and OS are affected by this issue? Did this work in previous versions of react-url-query?
1.5, Chrome 79, MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions