diff --git a/src/app/(main)/App.tsx b/src/app/(main)/App.tsx index 33f0e1f36..ec08838d1 100644 --- a/src/app/(main)/App.tsx +++ b/src/app/(main)/App.tsx @@ -5,22 +5,11 @@ import { UpdateNotice } from './UpdateNotice'; import { SideNav } from '@/app/(main)/SideNav'; import { useLoginQuery, useConfig, useNavigation } from '@/components/hooks'; import { MobileNav } from '@/app/(main)/MobileNav'; -import { useEffect } from 'react'; -import { removeItem, setItem } from '@/lib/storage'; -import { LAST_TEAM_CONFIG } from '@/lib/constants'; export function App({ children }) { const { user, isLoading, error } = useLoginQuery(); const config = useConfig(); - const { pathname, teamId } = useNavigation(); - - useEffect(() => { - if (teamId) { - setItem(LAST_TEAM_CONFIG, teamId); - } else { - removeItem(LAST_TEAM_CONFIG); - } - }, [teamId]); + const { pathname } = useNavigation(); if (isLoading || !config) { return ; diff --git a/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx b/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx index 13712f2ad..30976bff7 100644 --- a/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx +++ b/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx @@ -56,7 +56,7 @@ export function FunnelEditForm({ const defaultValues = { name: data?.name || '', window: data?.parameters?.window || 60, - steps: data?.parameters?.steps || [{ type: 'path', value: '' }], + steps: data?.parameters?.steps || [{ type: 'path', value: '/' }], }; return ( @@ -82,10 +82,12 @@ export function FunnelEditForm({ validate: value => value.length > 1 || 'At least two steps are required', }} > - {({ fields, append, remove }) => { + {({ fields, append, remove, getValues }) => { return ( {fields.map(({ id }: { id: string }, index: number) => { + const type = getValues(`steps.${index}.type`); + return ( @@ -101,8 +103,7 @@ export function FunnelEditForm({ name={`steps.${index}.value`} rules={{ required: formatMessage(labels.required) }} > - {({ field, context }) => { - const type = context.watch(`steps.${index}.type`); + {({ field }) => { return ; }} @@ -117,7 +118,7 @@ export function FunnelEditForm({ })}