From 5d15db7a7b618c9d05b462b5c371e291b9856080 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 1 Apr 2026 18:01:44 +0200 Subject: [PATCH] . --- .../use-list-customers-page.controller.ts | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/modules/customers/src/web/list/controllers/use-list-customers-page.controller.ts b/modules/customers/src/web/list/controllers/use-list-customers-page.controller.ts index cb0809b4..409c7ec1 100644 --- a/modules/customers/src/web/list/controllers/use-list-customers-page.controller.ts +++ b/modules/customers/src/web/list/controllers/use-list-customers-page.controller.ts @@ -1,5 +1,4 @@ import type { RightPanelMode } from "@repo/rdx-ui/hooks"; -import { useMemo } from "react"; import { useSearchParams } from "react-router-dom"; import { useCustomerSummaryPanelController } from "./use-customer-summary-panel.controller"; @@ -7,38 +6,15 @@ import { useListCustomersController } from "./use-list-customers.controller"; export const useListCustomersPageController = () => { const listCtrl = useListCustomersController(); - const [searchParams] = useSearchParams(); - // ----------------------------- - // URL → estado inicial (sync) - // ----------------------------- - const initialPanelState = useMemo(() => { - const customerId = searchParams.get("customerId"); - const panelMode = searchParams.get("panel") as RightPanelMode | null; + const customerId = searchParams.get("customerId") ?? ""; + const panelMode = (searchParams.get("panel") as RightPanelMode | null) ?? "view"; - if (!customerId) { - return { - customerId: "", - mode: "view" as RightPanelMode, - open: false, - }; - } - - return { - customerId, - mode: panelMode ?? "view", - open: true, - }; - }, [searchParams]); - - // ----------------------------- - // Controller con estado inicial - // ----------------------------- const panelCtrl = useCustomerSummaryPanelController({ - initialCustomerId: initialPanelState.customerId, - initialMode: initialPanelState.mode, - initialOpen: initialPanelState.open, + initialCustomerId: customerId, + initialMode: panelMode, + initialOpen: customerId !== "", }); return {