Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

addUnsavedChanges() will save same id multiple times #20

Open
liffiton opened this issue May 19, 2022 · 0 comments
Open

addUnsavedChanges() will save same id multiple times #20

liffiton opened this issue May 19, 2022 · 0 comments

Comments

@liffiton
Copy link

addUnsavedChanges() was intended to avoid saving the same id multiple times (the comment says "Don't add duplicate state"), but it still does. This means that multiple calls to addUnsavedChanges() with a given id followed by one call to removeUnsavedChanges() with that same id will leave other copies of the id in the array, and the beforeunload listener will still be active.

The issue is that the condition here is always true.

Instead of !indexOf(id) > -1 it should be !(indexOf(id) > -1), I believe.

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

No branches or pull requests

1 participant