diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
index 93c82251740..a23bf75eb81 100644
--- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx
@@ -22,6 +22,7 @@ import { useCheckGithubBranchValidity } from 'data/integrations/github-branch-ch
import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query'
import { projectKeys } from 'data/projects/keys'
import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
+import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { BASE_PATH, IS_PLATFORM } from 'lib/constants'
@@ -83,12 +84,26 @@ export const CreateBranchModal = () => {
onError: () => {},
})
+ const { mutate: sendEvent } = useSendEventMutation()
+
const { mutate: createBranch, isLoading: isCreating } = useBranchCreateMutation({
onSuccess: async (data) => {
toast.success(`Successfully created preview branch "${data.name}"`)
if (projectRef) {
await Promise.all([queryClient.invalidateQueries(projectKeys.detail(projectRef))])
}
+ sendEvent({
+ action: 'branch_create_button_clicked',
+ properties: {
+ branchType: data.persistent ? 'persistent' : 'preview',
+ gitlessBranching,
+ },
+ groups: {
+ project: ref ?? 'Unknown',
+ organization: selectedOrg?.slug ?? 'Unknown',
+ },
+ })
+
setShowCreateBranchModal(false)
router.push(`/project/${data.project_ref}`)
},
diff --git a/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx b/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx
index 73444da1e93..c90b7f99166 100644
--- a/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx
+++ b/apps/studio/components/interfaces/BranchManagement/OutOfDateNotice.tsx
@@ -13,6 +13,9 @@ import {
} from 'ui'
import { GitBranchIcon } from 'lucide-react'
import { Admonition } from 'ui-patterns'
+import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
+import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
+import { useSelectedProject } from 'hooks/misc/useSelectedProject'
interface OutOfDateNoticeProps {
isBranchOutOfDateMigrations: boolean
@@ -41,6 +44,12 @@ export const OutOfDateNotice = ({
}: OutOfDateNoticeProps) => {
const [isDialogOpen, setIsDialogOpen] = useState(false)
const hasOutdatedMigrations = isBranchOutOfDateMigrations && missingMigrationsCount > 0
+ const selectedOrg = useSelectedOrganization()
+ const project = useSelectedProject()
+ const { mutate: sendEvent } = useSendEventMutation()
+
+ const isBranch = project?.parent_project_ref !== undefined
+ const parentProjectRef = isBranch ? project?.parent_project_ref : project?.ref
const getTitle = () => {
if (hasOutdatedMigrations && (hasMissingFunctions || hasOutOfDateFunctions)) {
@@ -57,12 +66,24 @@ export const OutOfDateNotice = ({
return 'Update this branch to get the latest changes from the production branch.'
}
- const handleUpdateClick = () => {
- onPush()
- }
+ const handleUpdate = (shouldCloseDialog = false) => {
+ if (shouldCloseDialog) {
+ setIsDialogOpen(false)
+ }
+
+ // Track branch update
+ sendEvent({
+ action: 'branch_updated',
+ properties: {
+ modifiedEdgeFunctions: hasEdgeFunctionModifications,
+ source: 'out_of_date_notice',
+ },
+ groups: {
+ project: parentProjectRef ?? 'Unknown',
+ organization: selectedOrg?.slug ?? 'Unknown',
+ },
+ })
- const handleConfirmUpdate = () => {
- setIsDialogOpen(false)
onPush()
}
@@ -98,7 +119,9 @@ export const OutOfDateNotice = ({
Cancel
- Update anyway
+ handleUpdate(true)}>
+ Update anyway
+
@@ -106,7 +129,7 @@ export const OutOfDateNotice = ({