feat: resolving issues on loader

This commit is contained in:
=
2025-01-06 14:55:12 +05:30
parent 398adfaf76
commit 5225f5136a
4 changed files with 18 additions and 13 deletions
@@ -60,7 +60,7 @@ export default function NavHeader({
const [isHoveringCopyButton, setIsHoveringCopyButton] = useState(false); const [isHoveringCopyButton, setIsHoveringCopyButton] = useState(false);
const routerEnvSlug = useParams({ const routerEnvSlug = useParams({
from: ROUTE_PATHS.SecretDashboardPage.id, strict: false,
select: (el) => el.envSlug select: (el) => el.envSlug
}); });
@@ -125,7 +125,7 @@ export default function NavHeader({
</div> </div>
</> </>
)} )}
{isFolderMode && Boolean(secretPathSegments.length) && ( {isFolderMode && routerEnvSlug && Boolean(secretPathSegments.length) && (
<div className="flex items-center space-x-3"> <div className="flex items-center space-x-3">
<FontAwesomeIcon icon={faAngleRight} className="ml-3 mr-1.5 text-xs text-gray-400" /> <FontAwesomeIcon icon={faAngleRight} className="ml-3 mr-1.5 text-xs text-gray-400" />
<Link <Link
+9 -1
View File
@@ -27,7 +27,15 @@ const router = createRouter({
) )
}); });
router.subscribe("onBeforeLoad", ({ pathChanged }) => pathChanged && NProgress.start()); router.subscribe("onBeforeLoad", ({ pathChanged }) => {
if (pathChanged) {
NProgress.start();
const timer = setTimeout(() => {
clearTimeout(timer);
NProgress.done();
}, 3000);
}
});
router.subscribe("onLoad", () => NProgress.done()); router.subscribe("onLoad", () => NProgress.done());
// Register the router instance for type safety // Register the router instance for type safety
declare module "@tanstack/react-router" { declare module "@tanstack/react-router" {
@@ -12,7 +12,7 @@ export const navigateUserToOrg = async (navigate: NavigateFn, organizationId?: s
if (organizationId) { if (organizationId) {
localStorage.setItem("orgData.id", organizationId); localStorage.setItem("orgData.id", organizationId);
navigate({ to: `/org/${organizationId}/overview` }); navigate({ to: "/organization/secret-manager/overview" });
return; return;
} }
@@ -33,18 +33,14 @@ export const useNavigateToSelectOrganization = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const navigateToSelectOrganization = async (cliCallbackPort?: string) => { const navigateToSelectOrganization = async (cliCallbackPort?: string) => {
let redirectTo = "/login/select-organization?"; if (!config.defaultAuthOrgId) {
if (config.defaultAuthOrgId) {
redirectTo += `org_id=${config.defaultAuthOrgId}&`;
} else {
queryClient.invalidateQueries({ queryKey: userKeys.getUser }); queryClient.invalidateQueries({ queryKey: userKeys.getUser });
} }
if (cliCallbackPort) { navigate({
redirectTo += `callback_port=${cliCallbackPort}`; to: "/login/select-organization",
} search: { callback_port: cliCallbackPort, org_id: config.defaultAuthOrgId }
});
navigate({ to: redirectTo });
}; };
return { navigateToSelectOrganization }; return { navigateToSelectOrganization };
@@ -143,6 +143,7 @@ const Page = () => {
const [debouncedSearchFilter, setDebouncedSearchFilter] = useDebounce(filter.searchFilter); const [debouncedSearchFilter, setDebouncedSearchFilter] = useDebounce(filter.searchFilter);
const [filterHistory, setFilterHistory] = useState<Map<string, Filter>>(new Map()); const [filterHistory, setFilterHistory] = useState<Map<string, Filter>>(new Map());
// TODO(rbr): check why this fails
const createSecretPopUp = usePopUpState(PopUpNames.CreateSecretForm); const createSecretPopUp = usePopUpState(PopUpNames.CreateSecretForm);
const { togglePopUp } = usePopUpAction(); const { togglePopUp } = usePopUpAction();