From b44ad8e2f821635268f3bdd360eabfc8629ae129 Mon Sep 17 00:00:00 2001 From: DS Boyce <260543580+ds-boyce@users.noreply.github.com> Date: Wed, 28 Oct 2026 11:22:20 -0700 Subject: [PATCH] Scope beta feedback to the selected feature (#12237) --- src/screens/Settings/BetaFeaturesSettings.tsx | 2 +- .../components/BetaFeaturesFeedbackDialog.tsx | 60 +++++++++++++++---- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/screens/Settings/BetaFeaturesSettings.tsx b/src/screens/Settings/BetaFeaturesSettings.tsx index 2d7525b4f..25208a1da 100644 --- a/src/screens/Settings/BetaFeaturesSettings.tsx +++ b/src/screens/Settings/BetaFeaturesSettings.tsx @@ -259,7 +259,7 @@ export function BetaFeaturesSettingsScreen({}: Props) { ) diff --git a/src/screens/Settings/components/BetaFeaturesFeedbackDialog.tsx b/src/screens/Settings/components/BetaFeaturesFeedbackDialog.tsx index 938ee8d00..1b5bb88ff 100644 --- a/src/screens/Settings/components/BetaFeaturesFeedbackDialog.tsx +++ b/src/screens/Settings/components/BetaFeaturesFeedbackDialog.tsx @@ -10,6 +10,7 @@ import {useSession} from '#/state/session' import {atoms as a, useTheme, web} from '#/alf' import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' +import * as Select from '#/components/Select' import * as Toast from '#/components/Toast' import {Text} from '#/components/Typography' import {useAnalytics} from '#/analytics' @@ -18,28 +19,27 @@ const MAX_FEEDBACK_LENGTH = 300 export function BetaFeaturesFeedbackDialog({ control, - betaFeatureKeys, + betaFeatures, }: { control: Dialog.DialogControlProps /** - * The keys of the beta feature gates that are currently active for this user, - * attached to the feedback report for context. + * The current beta features, with the localized names shown in settings. */ - betaFeatureKeys: string[] + betaFeatures: {key: string; name: string}[] }) { return ( - + ) } function BetaFeaturesFeedbackDialogInner({ - betaFeatureKeys, + betaFeatures, }: { - betaFeatureKeys: string[] + betaFeatures: {key: string; name: string}[] }) { const t = useTheme() const {t: l} = useLingui() @@ -48,9 +48,14 @@ function BetaFeaturesFeedbackDialogInner({ const control = Dialog.useDialogContext() const [feedback, setFeedback] = useState('') + const [selectedKey, setSelectedKey] = useState('') + const selectedFeatureKey = + betaFeatures.length === 1 + ? betaFeatures[0].key + : betaFeatures.find(feature => feature.key === selectedKey)?.key const {mutate: onSubmit, isPending} = useMutation({ - mutationFn: () => { + mutationFn: (betaFeatureKey: string) => { /* * `captureFeedback` is a no-op when the Sentry client is disabled (e.g. in * dev, where `init` sets `enabled: false`). It returns synchronously @@ -63,17 +68,18 @@ function BetaFeaturesFeedbackDialogInner({ } Sentry.captureFeedback( {name: currentAccount?.handle, message: feedback.trim()}, - {captureContext: {contexts: {betaFeatures: {keys: betaFeatureKeys}}}}, + {captureContext: {contexts: {betaFeatures: {keys: [betaFeatureKey]}}}}, ) return Promise.resolve() }, - onSuccess: () => { + onSuccess: (_data, betaFeatureKey) => { ax.metric('betaFeatures:feedback:submit', { - betaFeatureKeys, + betaFeatureKeys: [betaFeatureKey], feedbackLength: feedback.trim().length, }) control.close(() => { setFeedback('') + setSelectedKey('') Toast.show(l`Thanks for your feedback!`) }) }, @@ -86,7 +92,8 @@ function BetaFeaturesFeedbackDialogInner({ }) const remaining = MAX_FEEDBACK_LENGTH - feedback.length - const canSubmit = feedback.trim().length > 0 && !isPending + const canSubmit = + !!selectedFeatureKey && feedback.trim().length > 0 && !isPending return ( + {betaFeatures.length > 1 && ( + + + + + + ({ + value: feature.key, + label: feature.name, + }))} + renderItem={({label, value}) => ( + + + {label} + + )} + /> + + )} onSubmit()}> + onPress={() => { + if (selectedFeatureKey) onSubmit(selectedFeatureKey) + }}> Submit feedback @@ -146,6 +179,7 @@ function BetaFeaturesFeedbackDialogInner({ onPress={() => control.close(() => { setFeedback('') + setSelectedKey('') }) }> -- knotmirror 0.0.1