From 30e642797da2cca1bc41bee754efb98658ad0a42 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 2 Nov 2026 22:09:56 -0800 Subject: [PATCH] fix(billing): close the Chat plan popup when its shell unmounts and name the organization's plan on organization routes --- .../components/chat-plan-modal/chat-plan-modal.tsx | 6 +++++- .../home/hooks/use-plan-upgrade-link.ts | 13 +++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/chat-plan-modal/chat-plan-modal.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/chat-plan-modal/chat-plan-modal.tsx index d39202f73f5..e96ae74fa42 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/chat-plan-modal/chat-plan-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/chat-plan-modal/chat-plan-modal.tsx @@ -1,5 +1,6 @@ 'use client' +import { useEffect } from 'react' import { ChipModal, ChipModalBody, @@ -15,12 +16,15 @@ import { useChatPlanModalStore } from '@/stores/modals/chat-plan/store' /** * Answers a send the workspace's plan refuses: Chat is on paid plans, with the way to upgrade - * for a viewer who may, and who to ask for one who may not. Render it once per workspace shell. + * for a viewer who may, and who to ask for one who may not. Render it once per workspace shell; + * leaving the shell closes it, so a refusal never reopens in the next workspace or organization. */ export function ChatPlanModal() { const isOpen = useChatPlanModalStore((state) => state.isOpen) const close = useChatPlanModalStore((state) => state.close) + useEffect(() => close, [close]) + return (