-
Notifications
You must be signed in to change notification settings - Fork 289
feat: post messages for log events so that Fylla Devtools can use it #4311
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
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.
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({
| if (isDevelopment && window) { | ||
| window.postMessage({ | ||
| type: 'FYLLA_LOG_DO_NOT_USE_OR_YOU_WILL_BE_FIRED', | ||
| events, | ||
| }); | ||
| } |
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.
Wouldn't it be better to actually send this in logEvent itself, then it becomes agnostic to direct sends or beacons?
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.
Direct sends are intercepted directly by the extension.
But we can omit the network interception, and only use the postMessage for both.
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.
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.
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