fix: apply in-page channel codecs to shared state - #372
Conversation
◈ PR Lens
Architecture 3 components touched across 2 lanes. Inside the changed components — 1 viewComponent view — In-page channel endpoints Page script and panel endpoints now route shared-state subscriptions, updates, and patches through serialization codecs. Data flow
Drill down
|
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to codec application points, aligns with the existing registry-based codec pipeline, and is backed by targeted regression tests.
Pull request overview
This PR fixes inconsistent application of in-page channel serialize/deserialize hooks for shared-state traffic, so shared-state subscription snapshots, full-state updates, and patch notifications all go through the codec pipeline in both directions (matching how regular RPC calls/events are already handled).
Changes:
- Apply
serializeArgs()when sending shared-state events/calls from both panel and page script. - Route shared-state internal handlers through
createLocalFunctionRegistry(codec)so incoming shared-state payloads are decoded (and outgoing snapshots/results encoded) consistently. - Add regression tests covering codec round-trips for snapshot + full-state + patch-array paths, and document the behavior in the in-page channel guide.
File summaries
| File | Description |
|---|---|
| packages/devframe/src/in-page-channel/panel.ts | Ensures panel-side shared-state traffic is encoded on send and decoded via registry-wrapped internal handlers. |
| packages/devframe/src/in-page-channel/page-script.ts | Ensures page-script shared-state notifications and per-peer shared-state handlers use the codec on both send and receive. |
| packages/devframe/src/in-page-channel/in-page-channel.test.ts | Adds regression coverage verifying shared-state snapshots and updates traverse both endpoint codecs. |
| docs/content/1.guide/12.in-page-channel.md | Documents that codec hooks apply to shared-state snapshots/updates/patch arrays in both directions. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
🟢 Approval recommended
It applies serialization/deserialization consistently across all shared-state wire paths and includes targeted regression coverage for both patch and full-state update modes.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
Shared-state updates in the in-page channel skipped the codec hooks, even though subscription snapshots passed through
deserialize. Applyserializeanddeserializeconsistently to snapshots, full-state updates, and patches in both directions, with regression tests for each path.I found this in pinia colada devtools where opening the devtools after the app was running was yielding double-deserialization on the data and after digging a bit, it turned out to be within devframe but I could be wrong.
This is the commit that is meant to be a workaround this bug: posva/pinia-colada@86e8ebf#diff-b8557b35c73d5dc5d785af45cfdfd8081ff9ebac962aa58b1fdcf6790cee0e2bR48-R53