diff --git a/src/components/Dashboard/common/ActionHandler.jsx b/src/components/Dashboard/common/ActionHandler.jsx index fa707cd..8e0c65e 100644 --- a/src/components/Dashboard/common/ActionHandler.jsx +++ b/src/components/Dashboard/common/ActionHandler.jsx @@ -30,6 +30,15 @@ const ActionHandler = forwardRef( navigate(newPath, { replace: true }) } + // Method to clear current action from URL + const clearAction = () => { + const searchParams = new URLSearchParams(location.search) + searchParams.delete(actionParam) + const newSearch = searchParams.toString() + const newPath = location.pathname + (newSearch ? `?${newSearch}` : '') + navigate(newPath, { replace: true }) + } + // Execute action and clear from URL useEffect(() => { if ( @@ -72,7 +81,8 @@ const ActionHandler = forwardRef( ]) useImperativeHandle(ref, () => ({ - callAction + callAction, + clearAction })) // Return null as this is a utility component