-
Notifications
You must be signed in to change notification settings - Fork 142
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
✨ Auto Flush for SDK extension #1824
Conversation
@@ -6,6 +6,7 @@ export const store: Store = { | |||
useDevBundles: false, | |||
useRumSlim: false, | |||
blockIntakeRequests: false, | |||
autoFlush: true, |
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.
I'd like to move away from the background
store: the state of the devtools panel should be local to the devtools instance/tab. Could you remove it here?
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.
isnt background store more about having defaults?
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.
no, it's a centralized store I used at the beginning when the extension was an icon next to the URL bar. Now that it is a devtools extension, it makes more sense to not use a centralized store, but keep each tab / devtools instance separated.
useEffect(flushEvents, []) | ||
useInterval(flushEvents, 5000) |
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.
🔨 warning: disabling auto flush won't work, as we don't check for the autoFlush
variable
🔨 warning: usehooks-ts is not compatible with our nodejs version (kind of weird but well...)
💬 suggestion: write a more well-suited hook ourselves:
function useAutoFlushEvents(enabled: boolean) {
useEffect(() => {
if (enabled) {
flushEvents()
const id = setInterval(flushEvents, FLUSH_EVENTS_INTERVAL)
return () => clearInterval(id)
}
}, [enabled])
}
// then use it in the `ActionBar` component like that:
useAutoFlushEvents(autoFlush)
Motivation
Add Auto Flush checkbox for SDK extensions
Testing
I have gone over the contributing documentation.