-
Notifications
You must be signed in to change notification settings - Fork 22
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
#9105: POC of mod variable sync #9106
Conversation
Playwright test results 6 failed Details Open report ↗︎ Failed testschrome-setup › setup/affiliated.setup.ts › authenticate with affiliated user Flaky testschrome-setup › setup/unaffiliated.setup.ts › authenticate with unaffiliated user Skipped testschrome › tests/bricks/sidebarEffects.spec.ts › sidebar effect bricks › toggle sidebar brick |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9106 +/- ##
==========================================
+ Coverage 74.24% 74.65% +0.41%
==========================================
Files 1332 1345 +13
Lines 40817 41731 +914
Branches 7634 7781 +147
==========================================
+ Hits 30306 31156 +850
- Misses 10511 10575 +64 ☔ View full report in Codecov by Sentry. |
@@ -54,6 +54,12 @@ import { initApiClient } from "@/data/service/apiClient"; | |||
// In the future, it might also run other background tasks from mods (e.g., background intervals) | |||
setPlatform(backgroundPlatform); | |||
|
|||
// Allows the content script to directly access the session storage for mod variables. Without this, we'd need to |
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.
Change required to allow content script to directly access session storage. Otherwise, we'd need to use messenger to broadcast state to tabs
const privateState = new Map<UUID, JsonObject>(); | ||
const keyPrefix = "#modVariables/"; | ||
|
||
const SCHEMA_POLICY_PROP = "x-sync-policy"; |
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.
The JSON Schema prop name for controlling the policy
Closing because POC sufficient for FLUPs for and won't be merged: https://www.notion.so/pixiebrix/Engagement-synchronize-mod-variables-across-navigation-tabs-b48726c01c5b4ef6a1f5e5e7e69d5da8?pvs=4 |
What does this PR do?
Approach
variables.schema
section to Mod Definition (as required)variables.schema
section to Activated Mod Component (as required)registerModVariables
method toplatform.state
protocolchrome.storage.session
for variables declared with a sync policy.Not Implemented
Demo
For more information on our expectations for the PR process, see the
code review principles doc