Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
fix gsc onboarding nudge state (#240)
Ben Senescu8ea55a3e77fd
diff --git a/src/client/features/gsc/GscReEngagementModal.tsx b/src/client/features/gsc/GscReEngagementModal.tsxindex 0d77382f..6d3511e5 100644--- a/src/client/features/gsc/GscReEngagementModal.tsx+++ b/src/client/features/gsc/GscReEngagementModal.tsx@@ -48,6 +48,10 @@ export function GscReEngagementModal({},});+ // Legacy users — those who finished onboarding before it included the Search+ // Console step — have no gscNudgeDismissedAt set, so they're the only ones who+ // see this. Anyone who completes current onboarding gets it stamped (they+ // already saw that step), and dismissing/connecting clears it too.const eligible =hosted &&!suppressed &&diff --git a/src/db/app.schema.ts b/src/db/app.schema.tsindex c75deb04..5a8b2995 100644--- a/src/db/app.schema.ts+++ b/src/db/app.schema.ts@@ -24,9 +24,9 @@ export const userOnboardingAnswers = sqliteTable(foundVia: text("found_via"),mcpSetupIntent: text("mcp_setup_intent"),completedAt: text("completed_at"),- // Set when the user dismisses (or acts on) the one-time "connect Search- // Console" nudge shown to people who finished onboarding before the GSC- // step existed. Null = never shown/dismissed.+ // Set when the user resolves the Search Console ask, either in current+ // onboarding or via the one-time re-engagement nudge for legacy users.+ // Null = not yet shown/resolved.gscNudgeDismissedAt: text("gsc_nudge_dismissed_at"),createdAt: text("created_at").notNull()diff --git a/src/serverFunctions/onboarding.ts b/src/serverFunctions/onboarding.tsindex f39fa62e..f1eab113 100644--- a/src/serverFunctions/onboarding.ts+++ b/src/serverFunctions/onboarding.ts@@ -82,7 +82,12 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" })...(data.mcpSetupIntent !== undefined? { mcpSetupIntent: data.mcpSetupIntent }: {}),- ...(completedAt !== undefined ? { completedAt } : {}),+ // Completing onboarding means the user passed the Search Console step, so+ // resolve the GSC prompt — the legacy re-engagement nudge must not fire+ // for anyone who already saw that step.+ ...(completedAt !== undefined+ ? { completedAt, gscNudgeDismissedAt: completedAt }+ : {}),updatedAt: now,};@@ -97,6 +102,7 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" })foundVia: data.foundVia,mcpSetupIntent: data.mcpSetupIntent,completedAt,+ gscNudgeDismissedAt: completedAt,updatedAt: now,}).onConflictDoUpdate({