Add metrics for composer threadgate (#9401)

* add metrics for composer threadgate

* add metrics to the in-thread version

* fix type error
This commit is contained in:
Samuel Newman
2025-11-17 20:51:01 +02:00
committed by GitHub
parent 53b3bd93a5
commit bc62b3da76
4 changed files with 37 additions and 1 deletions
@@ -10,6 +10,7 @@ import {useLingui} from '@lingui/react'
import {useQueryClient} from '@tanstack/react-query'
import {useHaptics} from '#/lib/haptics'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {logger} from '#/logger'
import {isIOS} from '#/platform/detection'
import {STALE} from '#/state/queries'
@@ -79,13 +80,26 @@ export function PostInteractionSettingsControlledDialog({
}: PostInteractionSettingsFormProps & {
control: Dialog.DialogControlProps
}) {
const onClose = useNonReactiveCallback(() => {
logger.metric('composer:threadgate:save', {
hasChanged: !!rest.isDirty,
persist: !!rest.persist,
replyOptions:
rest.threadgateAllowUISettings?.map(gate => gate.type)?.join(',') ?? '',
quotesEnabled: !rest.postgate?.embeddingRules?.find(
v => v.$type === embeddingRules.disableRule.$type,
),
})
})
return (
<Dialog.Outer
control={control}
nativeOptions={{
preventExpansion: true,
preventDismiss: rest.isDirty && rest.persist,
}}>
}}
onClose={onClose}>
<Dialog.Handle />
<DialogInner {...rest} />
</Dialog.Outer>