Fix contentScripts getting loaded multiple times #57
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.
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 incontent_scripts
.To fix this,
we need a single entry point (
entry.js
). Only that should be added incontent_scripts
. This is the quickest fix, without changing too much of the code structure, and has the option of refactoring in the futuredispatcher
- which did seem like an anti-pattern anyway - why does.dispatcher care about something needed only by one script?).
or, we need logically separated entry points. (needs refactor)
To achieve this, we would need some decoupling with the current
dispatcher
-- which wecan 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