-
Notifications
You must be signed in to change notification settings - Fork 142
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
✨ [devext] revamp extension settings #2250
✨ [devext] revamp extension settings #2250
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Codecov Report
@@ Coverage Diff @@
## benoit/developer-extension--revamp-communication #2250 +/- ##
====================================================================================
- Coverage 94.09% 93.99% -0.10%
====================================================================================
Files 201 201
Lines 6083 6083
Branches 1347 1347
====================================================================================
- Hits 5724 5718 -6
- Misses 359 365 +6 see 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
19606a0
to
8135d2f
Compare
// https://legacy.reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate | ||
const [, forceUpdate] = useReducer((x: number) => x + 1, 0) | ||
|
||
useEffect(() => { | ||
const subscription = onSettingsChange.subscribe(forceUpdate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: It is not clear to me why we need to do that, maybe adding a comment could help future reviewer as well
3ec53f6
to
fb22036
Compare
45fb402
to
a256c2a
Compare
This commit changes the way we define network rules to make sure they only apply on the tab where the devtools panel is open. When the devtools tab is closed, rules are cleared.
This commit removes the background store usage for settings.
Get rid of the store defined in the background script as it is not used anymore.
a256c2a
to
2573add
Compare
Motivation
The extension settings behaved a bit unexpectedly:
Changes
This PR moves the settings logic from the background script to the devtools. No more "store", now all settings are loaded from the extension storage when the devtools is open. Every time a setting changes, it is written to the extension storage without overriding other settings. Devtools instances are not subscribing to settings updates,
so it is possible to edit the settings in a devtools instance independently from other instances, but still have persistence. This mimics how Chrome devtools settings are working.
Because the network rules are not driven by a global "store" anymore, they can be activated per tab, thanks to the devtools connection.
Testing
I have gone over the contributing documentation.