[WEB-1652] fix: add optional channing to fix app crash if router params are not available. (#4871)
This commit is contained in:
parent
cff2161506
commit
a2d691a446
8 changed files with 10 additions and 10 deletions
|
|
@ -44,7 +44,7 @@ export const CycleGanttBlock: React.FC<Props> = observer((props) => {
|
|||
: "",
|
||||
}}
|
||||
onClick={() =>
|
||||
router.push(`/${workspaceSlug.toString()}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`)
|
||||
router.push(`/${workspaceSlug?.toString()}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`)
|
||||
}
|
||||
>
|
||||
<div className="absolute left-0 top-0 h-full w-full bg-custom-background-100/50" />
|
||||
|
|
@ -80,7 +80,7 @@ export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => {
|
|||
return (
|
||||
<Link
|
||||
className="relative flex h-full w-full items-center gap-2"
|
||||
href={`/${workspaceSlug.toString()}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`}
|
||||
href={`/${workspaceSlug?.toString()}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`}
|
||||
draggable={false}
|
||||
>
|
||||
<ContrastIcon
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export const CalendarIssueBlock = observer(
|
|||
return (
|
||||
<ControlLink
|
||||
id={`issue-${issue.id}`}
|
||||
href={`/${workspaceSlug.toString()}/projects/${projectId.toString()}/issues/${issue.id}`}
|
||||
href={`/${workspaceSlug?.toString()}/projects/${projectId?.toString()}/issues/${issue.id}`}
|
||||
target="_blank"
|
||||
onClick={() => handleIssuePeekOverview(issue)}
|
||||
className="block w-full text-sm text-custom-text-100 rounded border-b md:border-[1px] border-custom-border-200 hover:border-custom-border-400"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export const ProfileIssuesKanBanLayout: React.FC = observer(() => {
|
|||
<BaseKanBanRoot
|
||||
QuickActions={ProjectIssueQuickActions}
|
||||
canEditPropertiesBasedOnProject={canEditPropertiesBasedOnProject}
|
||||
viewId={profileViewId.toString()}
|
||||
viewId={profileViewId?.toString()}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const ProfileIssuesListLayout: FC = observer(() => {
|
|||
<BaseListRoot
|
||||
QuickActions={ProjectIssueQuickActions}
|
||||
canEditPropertiesBasedOnProject={canEditPropertiesBasedOnProject}
|
||||
viewId={profileViewId.toString()}
|
||||
viewId={profileViewId?.toString()}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export const SpreadsheetSubIssueColumn: React.FC<Props> = observer((props: Props
|
|||
const subIssueCount = issue?.sub_issues_count ?? 0;
|
||||
|
||||
const redirectToIssueDetail = () => {
|
||||
router.push(`/${workspaceSlug.toString()}/projects/${issue.project_id}/${issue.archived_at ? "archives/" : ""}issues/${issue.id}#sub-issues`);
|
||||
router.push(`/${workspaceSlug?.toString()}/projects/${issue.project_id}/${issue.archived_at ? "archives/" : ""}issues/${issue.id}#sub-issues`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
|||
const { workspaceSlug, projectId: routeProjectId } = useParams();
|
||||
// store hooks
|
||||
const workspaceStore = useWorkspace();
|
||||
const workspaceId = workspaceStore.getWorkspaceBySlug(workspaceSlug as string)?.id as string;
|
||||
const workspaceId = workspaceStore.getWorkspaceBySlug(workspaceSlug?.toString())?.id as string;
|
||||
const { config } = useInstance();
|
||||
const { getProjectById } = useProject();
|
||||
const { areEstimateEnabledByProjectId } = useProjectEstimates();
|
||||
|
|
@ -173,7 +173,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
|||
parent_id: formData.parent_id,
|
||||
});
|
||||
}
|
||||
if (projectId && routeProjectId !== projectId) fetchCycles(workspaceSlug, projectId);
|
||||
if (projectId && routeProjectId !== projectId) fetchCycles(workspaceSlug?.toString(), projectId);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [projectId]);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
|
|||
// if data is not present, set active project to the project
|
||||
// in the url. This has the least priority.
|
||||
if (workspaceProjectIds && workspaceProjectIds.length > 0 && !activeProjectId)
|
||||
setActiveProjectId(projectId.toString() ?? workspaceProjectIds?.[0]);
|
||||
setActiveProjectId(projectId?.toString() ?? workspaceProjectIds?.[0]);
|
||||
|
||||
// clearing up the description state when we leave the component
|
||||
return () => setDescription(undefined);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export const ModuleListItem: React.FC<Props> = observer((props) => {
|
|||
return (
|
||||
<ListItem
|
||||
title={moduleDetails?.name ?? ""}
|
||||
itemLink={`/${workspaceSlug}/projects/${moduleDetails.project_id}/modules/${moduleDetails.id}`}
|
||||
itemLink={`/${workspaceSlug?.toString()}/projects/${moduleDetails.project_id}/modules/${moduleDetails.id}`}
|
||||
onItemClick={handleItemClick}
|
||||
prependTitleElement={
|
||||
<CircularProgressIndicator size={30} percentage={progress} strokeWidth={3}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue