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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper function to avoid polluting global namespace #2362

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

frnhr
Copy link
Contributor

@frnhr frnhr commented Dec 9, 2022

Wrapped the clientside template JS code in an anonymous function. This prevents clientside and ns vars from polluting the global namespace.

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • 馃
    • 馃馃
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

@alexcjohnson
Copy link
Collaborator

Thanks @frnhr - good catch, thanks for the fix!

If you merge or rebase on the tip of dev the tests should pass. Then we'll just need:

  • a test that these variables are indeed not in the global namespace. Maybe in test_clientside.py pick any test and add a line at the end like assert dash_duo.driver.execute_script("return !(('clientside' in window) || ('ns' in window))")
  • a changelog entry

@frnhr frnhr marked this pull request as ready for review March 25, 2024 15:46
@frnhr
Copy link
Contributor Author

frnhr commented Mar 25, 2024

PR ready for review.

Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 馃拑

@T4rk1n T4rk1n merged commit 230d664 into plotly:dev Mar 29, 2024
3 checks passed
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.

None yet

3 participants