From d184d12388778631d5c3881614afe8442ef6bca8 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Mon, 15 Apr 2024 17:14:51 +0200 Subject: [PATCH] added refresh to list tenants. --- src/components/utilities/TenantSelector.jsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/utilities/TenantSelector.jsx b/src/components/utilities/TenantSelector.jsx index a7c059c39d4f..df8eb7d00459 100644 --- a/src/components/utilities/TenantSelector.jsx +++ b/src/components/utilities/TenantSelector.jsx @@ -13,6 +13,7 @@ import CippTenantOffcanvas from './CippTenantOffcanvas' import CippfuzzySearch from './CippFuzzySearch' const TenantSelector = ({ action, showAllTenantSelector = true, NavSelector = false }) => { + const [refreshState, setRefreshState] = React.useState(false) const currentTenant = useSelector((state) => state.app.currentTenant) const { data: tenants = [ @@ -23,9 +24,10 @@ const TenantSelector = ({ action, showAllTenantSelector = true, NavSelector = fa }, ], isLoading, + isFetching, isSuccess, error, - } = useListTenantsQuery({ showAllTenantSelector }) + } = useListTenantsQuery({ showAllTenantSelector, Refresh: refreshState }) const dispatch = useDispatch() const navigate = useNavigate() @@ -90,10 +92,10 @@ const TenantSelector = ({ action, showAllTenantSelector = true, NavSelector = fa )} -
+
+ + //set a random number to force a refresh + setRefreshState(Math.random()) + } + variant="ghost" + className="ml-2" + > + +
)}