Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modifies the non-xhr event listener to ensure that it will only run a single time (initial page load) and not on subsequent page loads unless the event listener is set up again. This resolves issues where a user would navigate to a page that had high charts in place, and then navigate to another page and get inundated with console errors because the event was attempting to run setup on the charts again with containers that did not exist (or, erroneously get charts set up in containers that should not have them on the new page).
Likewise, it ensures that subsequent page visits to the page that set up the event listener does not set up multiple repetitive event listener events that perform the same action, as the previous set up would add on another duplicate but different event listener to the
document
(orwindow
in the case of non-xhr and non-Turbo(links)) element every single time the page was loaded without ever removing any of the old listeners.Resolves an issue introduced in PR #258
Resolves #255
Resolves #223
Supersedes PR #249
Supersedes PR #224