diff --git a/src/app/(main)/App.tsx b/src/app/(main)/App.tsx
index ec08838d1..33f0e1f36 100644
--- a/src/app/(main)/App.tsx
+++ b/src/app/(main)/App.tsx
@@ -5,11 +5,22 @@ 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 } = useNavigation();
+ const { pathname, teamId } = useNavigation();
+
+ useEffect(() => {
+ if (teamId) {
+ setItem(LAST_TEAM_CONFIG, teamId);
+ } else {
+ removeItem(LAST_TEAM_CONFIG);
+ }
+ }, [teamId]);
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 30976bff7..13712f2ad 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,12 +82,10 @@ export function FunnelEditForm({
validate: value => value.length > 1 || 'At least two steps are required',
}}
>
- {({ fields, append, remove, getValues }) => {
+ {({ fields, append, remove }) => {
return (
{fields.map(({ id }: { id: string }, index: number) => {
- const type = getValues(`steps.${index}.type`);
-
return (
@@ -103,7 +101,8 @@ export function FunnelEditForm({
name={`steps.${index}.value`}
rules={{ required: formatMessage(labels.required) }}
>
- {({ field }) => {
+ {({ field, context }) => {
+ const type = context.watch(`steps.${index}.type`);
return ;
}}
@@ -118,7 +117,7 @@ export function FunnelEditForm({
})}