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 contentScripts getting loaded multiple times #57

Closed

Conversation

palashkaria
Copy link
Contributor

@palashkaria palashkaria commented May 17, 2020

This attempts to fix the problem discussed here: #52 (comment)

Root cause: We were loading all contentScripts more than one time (some cases - 3) - once in either /dispatcher or /features (or both), and again by their own separate entry in content_scripts.

To fix this,

  1. we need a single entry point (entry.js). Only that should be added in content_scripts. This is the quickest fix, without changing too much of the code structure, and has the option of refactoring in the future

    • (except no global dispatcher - which did seem like an anti-pattern anyway - why does.
      dispatcher care about something needed only by one script?).
    • I have implemented this & also added logs statements to verify the scripts loading.
  2. or, we need logically separated entry points. (needs refactor)
    To achieve this, we would need some decoupling with the current dispatcher -- which we
    can call keyboardShortcutsDispatcher.

Note: A file should only be present in only one of the entry points (in /entry): either /dispatcher, or /features. If not, it will get loaded multiple times.

Feel free to make changes to this as required @Stvad

@@ -6,7 +6,7 @@
"icons": {
"128": "assets/icon-128.png"
},
"content_security_policy": "script-src 'self'; object-src 'self'",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
Copy link
Member

Choose a reason for hiding this comment

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

👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need a better dev flow :) I keep committing this accidentally

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I agree that this is annoying. I have this ignored on IDE level, but..

@Stvad
Copy link
Member

Stvad commented May 17, 2020

closing in favor of #58

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

2 participants