Skip to content

Conversation

@omBratteng
Copy link
Member

@omBratteng omBratteng commented Mar 26, 2025

Changes

The Fylla Devtools can natively listen for web traffic, but for sendBeacon we need to send messages to the extension.

Preview domain

https://fylla-devtools.preview.app.daily.dev

@vercel
Copy link

vercel bot commented Mar 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Mar 31, 2025 8:29am
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Mar 31, 2025 8:29am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to broadcast log events via messages for Fylla Devtools, enabling support for sendBeacon log messages.

  • Added a window.postMessage call with a custom message type for log events.
  • Integrated log events into the postMessage payload to alert the extension of new logs.
Comments suppressed due to low confidence (1)

packages/shared/src/hooks/log/useLogQueue.ts:82

  • [nitpick] The event type 'FYLLA_LOG_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' is overly aggressive, which may not be suitable for production code; consider using a more neutral naming and extracting it into a constant.
window.postMessage({

Comment on lines +83 to +88
if (isDevelopment && window) {
window.postMessage({
type: 'FYLLA_LOG_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
events,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to actually send this in logEvent itself, then it becomes agnostic to direct sends or beacons?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct sends are intercepted directly by the extension.
But we can omit the network interception, and only use the postMessage for both.

Copy link
Contributor

@capJavert capJavert Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non blocking but we should use https://developer.chrome.com/docs/extensions/reference/api/runtime#method it is more secure and specific only to extension. postMessage can be listened by any 3rd party script.

@omBratteng omBratteng merged commit 1fed548 into main Mar 31, 2025
10 checks passed
@omBratteng omBratteng deleted the fylla-devtools branch March 31, 2025 11:15
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.

4 participants