Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(subscriptions): make long report prompts scrollable (#102915)

Daniel Parker007039b3bf27
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 325ea969e0ad..ee7fd4a156a9 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6292,6 +6292,10 @@ snapshots:
hash: v1.k794b7964.fdd194fa7f91e1eaa642256ba2dd7e0951bc382b7df24e39c504ba428cfabe0a.KLwxXJI2yw_P7hQMu-vHOJKoXi4mSHf3IVabPbV2vdM
products-subscriptions-subscriptions-modal--insight-with-subscriptions--light:
hash: v1.k794b7964.0850b21723e94659d48e7930f44b3806423409fa4e324370cea825f7ee834371.uKJgYFJ-_LNL0M6CQHDlG1kNfpEccF8eSmPDv3hO-1c
+ products-subscriptions-subscriptions-modal--long-ai-prompt--dark:
+ hash: v1.k794b7964.4248b9034e799f5515f79e1ce1be94acbf161108a113024a695378bbf6f91964.nU8G1dPefUfme1EtuazK3GPd4iK3QnD3f1z8N9F6FwI
+ products-subscriptions-subscriptions-modal--long-ai-prompt--light:
+ hash: v1.k794b7964.85b384652aa5b517eed36632295946d61480bcb5532cbda74aeec4842cec02a3.e-ZcvcwAErz7aFdzJ467YrWnVuqNq34A89JytLtG45A
products-subscriptions-subscriptions-modal--subscription-wizard-new--dark:
hash: v1.k794b7964.e5aa7358fd68838279ee1a054c4da58e139de7f8cdf7cc31fc55858cf62db633.2cy5yElBtv75-dE9TsJ5XINpT4QnHYAf_g405VzPZ2I
products-subscriptions-subscriptions-modal--subscription-wizard-new--light:
diff --git a/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx b/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx
index f93602efa0f4..cbb4a2873165 100644
--- a/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx
+++ b/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx
@@ -149,6 +149,7 @@ export function AiPromptFields({
<LemonTextArea
placeholder="e.g. Which events grew the most week-over-week? Highlight any unusual spikes."
minRows={4}
+ maxRows={12}
maxLength={SubscriptionAIPromptMaxLength.CHARACTERS}
/>
</LemonField>
diff --git a/products/subscriptions/frontend/components/Subscriptions/SubscriptionsModal.stories.tsx b/products/subscriptions/frontend/components/Subscriptions/SubscriptionsModal.stories.tsx
index 22b31ada62de..5b29971fab5e 100644
--- a/products/subscriptions/frontend/components/Subscriptions/SubscriptionsModal.stories.tsx
+++ b/products/subscriptions/frontend/components/Subscriptions/SubscriptionsModal.stories.tsx
@@ -15,7 +15,8 @@ import { DashboardType, InsightShortId, Realm, SubscriptionType } from '~/types'
import { SubscriptionsModal, SubscriptionsModalProps } from './SubscriptionsModal'
type StoryArgs = SubscriptionsModalProps & {
- formScenario?: 'default' | 'ai-summary-limit' | 'free-tier-limit'
+ formScenario?: 'default' | 'ai-summary-limit' | 'free-tier-limit' | 'long-ai-prompt'
+ openAsModal?: boolean
}
const DASHBOARD = {
@@ -164,6 +165,19 @@ const AI_PROMPT_SUBSCRIPTIONS = [
}),
]
+const LONG_AI_PROMPT_SUBSCRIPTION = createMockSubscription({
+ id: 21,
+ resource_type: 'ai_prompt',
+ title: 'Weekly product health report',
+ prompt: Array.from(
+ { length: 18 },
+ () => 'Compare activation, retention, and revenue with the previous week. Explain each important change.'
+ ).join('\n\n'),
+ target_type: 'email',
+ target_value: '[email protected]',
+ created_by: mockBasicUser,
+})
+
const AI_PROMPT_PARAMETERS = {
featureFlags: {
[FEATURE_FLAGS.SUBSCRIPTION_AI_PROMPT]: true,
@@ -181,17 +195,17 @@ const meta: Meta<StoryArgs> = {
argTypes: {
formScenario: {
control: 'select',
- options: ['default', 'ai-summary-limit', 'free-tier-limit'],
+ options: ['default', 'ai-summary-limit', 'free-tier-limit', 'long-ai-prompt'],
},
},
render: (args) => {
- const { formScenario = 'default', ...props } = args
+ const { formScenario = 'default', openAsModal = false, ...props } = args
const aiSummaryAtLimit = formScenario === 'ai-summary-limit'
const freeTierSubscriptionCount = formScenario === 'free-tier-limit' ? 5 : undefined
const insightShortIdRef = useRef(props.insightShortId || (uuid() as InsightShortId))
// Dashboard-context stories must not also pass an insight, or the modal renders the insight flow.
const insightShortId = props.dashboard ? undefined : insightShortIdRef.current
- const [modalOpen, setModalOpen] = useState(false)
+ const [modalOpen, setModalOpen] = useState(openAsModal)
const contextualSubscriptions: SubscriptionType[] = props.dashboard
? DASHBOARD_SUBSCRIPTIONS
: INSIGHT_SUBSCRIPTIONS
@@ -222,7 +236,9 @@ const meta: Meta<StoryArgs> = {
return { count: results.length, results }
},
- '/api/environments/:id/subscriptions/:subId': createMockSubscription(),
+ '/api/environments/:id/subscriptions/:subId':
+ formScenario === 'long-ai-prompt' ? LONG_AI_PROMPT_SUBSCRIPTION : createMockSubscription(),
+ '/api/projects/:id/subscriptions/:subId/deliveries': { results: [] },
...(freeTierSubscriptionCount !== undefined
? { '/api/projects/:id/subscriptions/': { count: freeTierSubscriptionCount, results: [] } }
: {}),
@@ -282,6 +298,17 @@ export const SubscriptionWizardNew: Story = {
args: { isCreating: true, formScenario: 'default' },
}
+export const LongAiPrompt: Story = {
+ parameters: {
+ ...AI_PROMPT_PARAMETERS,
+ pageUrl: '/subscriptions/21/edit',
+ testOptions: {
+ viewport: { width: 1032, height: 900 },
+ },
+ },
+ args: { subscriptionId: 21, formScenario: 'long-ai-prompt', openAsModal: true },
+}
+
// Tabbed overview, dashboard context: This dashboard / Insights / AI prompt reports tabs.
export const SubscriptionsTabbed: Story = {
parameters: {