Skip to content

fix(pp-dev): WebSocket per-client responses and sub-path template variable loading - #168

Merged
sergak01 merged 2 commits into
developfrom
pp-3449
Jun 11, 2026
Merged

fix(pp-dev): WebSocket per-client responses and sub-path template variable loading#168
sergak01 merged 2 commits into
developfrom
pp-3449

Conversation

@sergak01

@sergak01 sergak01 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two dev-server bugs (PP-3449):

  1. Dev-panel WebSocket responses were broadcast to every connected client.
  2. Template variables were not loaded when the first request was a deep-linked sub-path.

Key changes

  • fix(client): dev-panel WebSocket responses go to the requesting client only. Dev-panel replies used server.ws.send(), which Vite broadcasts to every connected client. Each response is now routed through the WebSocketClient passed to the event handler, so info-data, template:sync:*, action-required, and config:update reach only the tab that initiated the request.
  • fix(middleware): template variables load on deep-linked sub-path navigation. Template data was loaded only when the first request matched the exact main page URL (/pl/<name>). Opening a deep-linked sub-path (e.g. an SPA route) left variables unloaded. Data now also loads on the first HTML-document navigation under the app base (detected via Sec-Fetch-Dest / Accept), so asset/XHR requests are unaffected; the load is cached and stays a no-op afterwards. The base is passed as a dedicated appBase option used only for navigation scoping, leaving the auth-failure redirect URL unchanged to avoid a redirect loop on v7.

Testing

  • npm run test:unit — 162 passed
  • npm run test:integration — 35 passed (includes new sub-path navigation tests)
  • tsc --noEmit — clean
  • Added regression tests: targeted WebSocket responses (tests/unit/lib/client.service.spec.ts) and sub-path/asset/out-of-base loading (tests/integration/middleware/load-pp-data.spec.ts).

Included commits

  • fix(middleware): load template variables on deep-linked sub-path navigation
  • fix(client): send dev-panel WebSocket responses to the requesting client only

Merge Request: origin/pp-3449origin/develop

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d773c2a1-392f-4956-a83b-81938cac637d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pp-3449

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

sergak01 added 2 commits June 11, 2026 16:57
…ent only

Dev-panel replies were sent via server.ws.send(), which Vite broadcasts to
every connected client. Route each response through the WebSocketClient passed
to the event handler so info-data, template:sync:*, action-required, and
config:update reach only the tab that initiated the request.

Add regression tests covering targeted info-data and template:sync responses.
…gation

Template data was loaded only when the first request matched the exact main page
URL. Opening a deep-linked sub-path (e.g. an SPA route) left template variables
unloaded, breaking page injection.

Load template data also on the first HTML-document navigation under the app base
(detected via Sec-Fetch-Dest / Accept), so asset and XHR requests are unaffected;
the load is cached and stays a no-op afterwards. The base is passed as a dedicated
appBase option used only for navigation scoping, leaving the auth-failure redirect
URL unchanged to avoid a redirect loop on v7.

Add integration tests for sub-path, asset, and out-of-base requests.
@sergak01 sergak01 self-assigned this Jun 11, 2026
@sergak01
sergak01 merged commit cd472c0 into develop Jun 11, 2026
3 checks passed
@sergak01
sergak01 deleted the pp-3449 branch June 11, 2026 14:17
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.

1 participant