Skip to content

Commit

Permalink
Fix: build is failing because of type issues in issueHistory store
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmullapudi committed Nov 25, 2024
1 parent 65e35aa commit d85316a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
14 changes: 14 additions & 0 deletions apps/webapp/src/common/types/issue-relation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ export enum IssueRelationEnum {
SIMILAR = 'SIMILAR',
}

export const IssueRelationEnumType = {
BLOCKS: 'BLOCKS',
BLOCKED: 'BLOCKED',
RELATED: 'RELATED',
DUPLICATE: 'DUPLICATE',
DUPLICATE_OF: 'DUPLICATE_OF',
PARENT: 'PARENT',
SUB_ISSUE: 'SUB_ISSUE',
SIMILAR: 'SIMILAR',
};

export type IssueRelationEnumType =
(typeof IssueRelationEnumType)[keyof typeof IssueRelationEnumType];

export interface IssueRelationType {
id: string;
createdAt: string;
Expand Down
10 changes: 5 additions & 5 deletions apps/webapp/src/common/types/issue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IssueRelationEnum } from './issue-relation';
import { IssueRelationEnumType } from './issue-relation';

export interface IssueSourceMetadataType {
type: string;
Expand Down Expand Up @@ -43,7 +43,7 @@ export interface IssueHistoryType {
createdAt: string;
updatedAt: string;
userId?: string;
issueId: string;
issueId?: string;
addedLabelIds: string[];
removedLabelIds: string[];
fromPriority?: number;
Expand All @@ -58,9 +58,9 @@ export interface IssueHistoryType {
toParentId?: string;
relationChanges?: {
isDeleted?: boolean;
issueId: string;
relatedIssueId: string;
type: IssueRelationEnum;
issueId?: string;
relatedIssueId?: string;
type?: IssueRelationEnumType;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ export function SubscribeView() {
};

return (
<div className="flex gap-2 items-center">
<div className="flex gap-2 shrink-0 items-center">
<div>
<Button variant="ghost" onClick={toggleSubscribe}>
<Button variant="ghost" onClick={toggleSubscribe} className="mr-1">
{subscribed ? 'Unsubscribe' : 'Subscribe'}
</Button>
</div>
{issue.subscriberIds.length > 0 && (
<div className="flex">
<SubscribeDropdown value={issue.subscriberIds} />
</div>
<SubscribeDropdown value={issue.subscriberIds} />
)}
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/webapp/src/store/conversation-history/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const ConversationHistory = types.model({
createdAt: types.string,
updatedAt: types.string,
message: types.string,
context: types.union(types.null, types.undefined, types.string),
thoughts: types.union(types.null, types.undefined, types.string),
context: types.union(types.null, types.string),
thoughts: types.union(types.null, types.string),
userId: types.union(types.null, types.string),
userType: types.enumeration(['Agent', 'User', 'System']),
conversationId: types.string,
Expand Down
9 changes: 6 additions & 3 deletions apps/webapp/src/store/issue-history/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ export const RelationChangeModel = types.model({
'RELATED',
'DUPLICATE',
'DUPLICATE_OF',
'SIMILAR',
'SUB_ISSUE',
'PARENT',
]),
relatedIssueId: types.string,
issueId: types.string,
relatedIssueId: types.union(types.string, types.null),
issueId: types.union(types.string, types.null),
isDeleted: types.union(types.boolean, types.undefined),
});

Expand All @@ -18,7 +21,7 @@ export const IssueHistory = types.model({
createdAt: types.string,
updatedAt: types.string,
userId: types.union(types.string, types.null),
issueId: types.string,
issueId: types.union(types.null, types.undefined, types.string),

addedLabelIds: types.array(types.string),
removedLabelIds: types.array(types.string),
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/src/store/issue-history/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const IssueHistoryStore: IAnyStateTreeNode = types
return { update, deleteById, load };
})
.views((self) => ({
getIssueHistories(issueId: string) {
getIssueHistories(issueId: string): IssueHistoryType[] {
return issueId === self.issueId ? self.issueHistories : [];
},
}));
Expand Down

0 comments on commit d85316a

Please sign in to comment.