chore: handle undefined identifier case

This commit is contained in:
Aaryan Khandelwal 2024-06-06 17:02:47 +05:30
parent b24e530816
commit 282597bf83
4 changed files with 9 additions and 39 deletions

View file

@ -120,7 +120,7 @@ export const IssueBlock = observer((props: IssueBlockProps) => {
};
//TODO: add better logic. This is to have a min width for ID/Key based on the length of project identifier
const keyMinWidth = (projectIdentifier.length + 5) * 7;
const keyMinWidth = ((projectIdentifier?.length ?? 0) + 5) * 7;
return (
<div

View file

@ -223,7 +223,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
const isIssueSelected = selectionHelpers.getIsEntitySelected(issueDetail.id);
//TODO: add better logic. This is to have a min width for ID/Key based on the length of project identifier
const keyMinWidth = (getProjectIdentifierById(issueDetail.project_id)?.length + 5) * 7;
const keyMinWidth = (getProjectIdentifierById(issueDetail.project_id)?.length ?? 0 + 5) * 7;
return (
<>

View file

@ -28,7 +28,7 @@ export interface IProjectStore {
currentProjectDetails: IProject | undefined;
// actions
getProjectById: (projectId: string) => IProject | null;
getProjectIdentifierById: (projectId: string) => string;
getProjectIdentifierById: (projectId: string) => string | undefined;
// fetch actions
fetchProjects: (workspaceSlug: string) => Promise<IProject[]>;
fetchProjectDetails: (workspaceSlug: string, projectId: string) => Promise<IProject>;
@ -261,7 +261,7 @@ export class ProjectStore implements IProjectStore {
* @param projectId
* @returns string
*/
getProjectIdentifierById = computedFn((projectId: string) => {
getProjectIdentifierById = computedFn((projectId: string): string | undefined => {
const projectInfo = this.projectMap?.[projectId];
return projectInfo?.identifier;
});