Skip to content

Conversation

ben-fornefeld
Copy link
Member

@ben-fornefeld ben-fornefeld commented Sep 23, 2025

In #128 we disabled the dashboard feedback survey popover, because it caused problems. The following applied, seems to have fixed this issue:

  • changing the posthog relay from /ingest to /ph-proxy
  • adding advanced_enable_surveys to posthog init, to ensure relevant surveys are not hidden behind ph feature flags
  • re-configuring the issue exactly as in their latest docs

New - Closed:
image

New - Open
image


Note

Re-enables the dashboard feedback survey using a new PostHog provider and /ph-proxy, while migrating validation to zod v4 and updating related deps/config.

  • Analytics & Surveys:
    • Introduces src/features/posthog-provider.tsx and wraps app with PostHogProvider to initialize PostHog (surveys enabled) and expose dashboardFeedbackSurvey.
    • Refactors DashboardSurveyPopover to use provider, accept custom trigger, and capture show/dismiss/submit events; integrates a Feedback button in the sidebar footer.
    • Changes Next.js rewrites from /ingest to /ph-proxy and updates middleware matcher to exclude ph-proxy.
    • Upgrades posthog-js and @posthog/core.
  • Validation (zod v4 migration):
    • Replaces z.string().email(), z.string().url(), z.string().uuid() with z.email(), z.url(), z.uuid() across server/client schemas (auth, billing, keys, sandboxes, team, env, user, etc.).
    • Updates dependencies to zod@^4 and zod-form-data@^3.
  • UI/Layouts:
    • Removes unused teamIdOrSlug props from dashboard layout/header.
    • Adds status bar/updated sidebar CSS vars; exports sidebarMenuButtonVariants and adds variants (incl. inverted); minor styling tweaks (e.g., remove border in start-rate-chart).
  • Config:
    • next.config.mjs rewrites updated; tsconfig.json switches JSX to preserve.
    • Lockfile and package.json dependency bumps (Supabase libs, PostHog).

Written by Cursor Bugbot for commit 7a5331b. This will update automatically on new commits. Configure here.

…schemas

- Reformatted `tsconfig.json` for better readability by aligning array elements.
- Changed JSX setting from `react-jsx` to `preserve` in `tsconfig.json`.
- Updated Zod validation in `get-api-keys.ts` and `key-actions.ts` to use `z.uuid()` for team and API key IDs, enhancing error handling.
- Improved type inference in `formatErrors` function in `env.ts` for better type safety.
…kage.json and bun.lock

- Updated `@supabase/ssr` from `^0.5.2` to `^0.7.0`.
- Upgraded `@supabase/supabase-js` from `^2.48.1` to `^2.57.4`.
- Changed `zod` version from `^3.24.1` to `^4.1.11`.
- Updated `@supabase/functions-js` from `2.4.5` to `2.4.6`, `@supabase/postgrest-js` from `1.21.3` to `1.21.4`, and `@supabase/realtime-js` from `2.15.4` to `2.15.5`.
- Adjusted `@supabase/storage-js` from `2.11.0` to `2.12.1` and `cookie` from `0.7.2` to `1.0.2` in lock files.
- Upgraded `posthog-js` and `@posthog/core` to version `1.268.1` and `1.1.0` respectively in `package.json` and `bun.lock`.
- Refactored Next.js rewrites to use `/ph-proxy` instead of `/ingest` for PostHog API calls.
- Simplified `DashboardLayoutView` component by removing unnecessary props.
- Enhanced `PostHogProvider` to include validation for `NEXT_PUBLIC_POSTHOG_HOST`.
- Implemented a new `DashboardSurveyPopoverResolver` to conditionally render the survey popover based on environment variables.
- Updated sidebar to include the survey popover for user feedback collection.
- Downgraded `@supabase/ssr` from `^0.7.0` to `^0.5.2` and `@supabase/supabase-js` from `^2.57.4` to `^2.48.1` in `package.json` and `bun.lock`.
- Updated `cookie` dependency from `1.0.2` to `0.7.2`.
- Refactored Zod schema merging in `env.ts` to use `merge` instead of `extend` for better clarity.
@ben-fornefeld ben-fornefeld added the improvement Improvements in-code label Sep 23, 2025
Copy link

linear bot commented Sep 23, 2025

Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web Ready Ready Preview Comment Sep 29, 2025 11:17pm
web-juliett Ready Ready Preview Comment Sep 29, 2025 11:17pm

- Modified the `DashboardSurveyPopover` button styles for improved hover effects and layout.
- Adjusted the `StartRateChartClient` component by removing an unnecessary border class.
- Enhanced the `DashboardSidebarFooter` structure for better organization and added a separate survey menu item.
- Introduced a new CSS variable for the protected status bar height in `theme.css`.
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

- Updated the `DashboardSurveyPopover` to accept a trigger prop for better flexibility.
- Refactored the `DashboardSidebarFooter` to integrate the survey popover with improved styling and layout.
- Adjusted the `general-analytics-collector` to ensure proper PostHog reset functionality.
- Modified CSS variables for sidebar width to improve responsiveness.
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@ben-fornefeld
Copy link
Member Author

Bug: Zod Schema Validation Property Mismatch

Zod schema definitions are using the error property for custom validation messages, but Zod v4 expects message or a direct string. This affects z.uuid and z.string schemas for teamId, name, and apiKeyId fields, which may lead to validation errors at runtime.

src/server/keys/key-actions.ts#L13-L16

const CreateApiKeySchema = z.object({
teamId: z.uuid({ error: 'Team ID is required' }),
name: z
.string({ error: 'Name is required' })

src/server/keys/get-api-keys.ts#L10-L11

src/server/keys/key-actions.ts#L64-L66

Fix in Cursor Fix in Web

https://zod.dev/v4/changelog?id=deprecates-message
message was deprecated, error is favored.

- Replaced deprecated Zod string validation for email and UUID with the new syntax.
- Removed the unused `.eslintignore` file to clean up the project structure.
- Enhanced various schemas across the application for consistency and clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements in-code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants