Compare commits

...

1 Commits

Author SHA1 Message Date
Jiayuan Zhang
627059bc34 fix(projects): pre-fill project on per-status "+" create-issue
The "+" button in each status column/section opens the create-issue
modal. On the project detail page it was passing only `{ status }`,
so the new issue's project field came up empty even though the user
was clearly in a project context. Thread `projectId` through
BoardView/ListView down to BoardColumn/StatusAccordionItem and
include `project_id` in the modal payload when set.

Co-authored-by: multica-agent <github@multica.ai>
2026-05-06 18:42:28 +08:00
4 changed files with 24 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ export function BoardColumn({
childProgressMap,
totalCount,
footer,
projectId,
}: {
status: IssueStatus;
issueIds: string[];
@@ -35,6 +36,8 @@ export function BoardColumn({
childProgressMap?: Map<string, ChildProgress>;
totalCount?: number;
footer?: ReactNode;
/** When set, the per-column "+" pre-fills the project on the create form. */
projectId?: string;
}) {
const cfg = STATUS_CONFIG[status];
const { setNodeRef, isOver } = useDroppable({ id: status });
@@ -80,7 +83,11 @@ export function BoardColumn({
variant="ghost"
size="icon-sm"
className="rounded-full text-muted-foreground"
onClick={() => useModalStore.getState().open("create-issue", { status })}
onClick={() =>
useModalStore
.getState()
.open("create-issue", { status, ...(projectId ? { project_id: projectId } : {}) })
}
>
<Plus className="size-3.5" />
</Button>

View File

@@ -106,6 +106,7 @@ export function BoardView({
childProgressMap = EMPTY_PROGRESS_MAP,
myIssuesScope,
myIssuesFilter,
projectId,
}: {
issues: Issue[];
visibleStatuses: IssueStatus[];
@@ -119,6 +120,8 @@ export function BoardView({
/** When set, per-status load-more targets the scoped cache instead of the workspace one. */
myIssuesScope?: string;
myIssuesFilter?: MyIssuesFilter;
/** When set, the per-column "+" pre-fills the project on the create form. */
projectId?: string;
}) {
const sortBy = useViewStore((s) => s.sortBy);
const sortDirection = useViewStore((s) => s.sortDirection);
@@ -289,6 +292,7 @@ export function BoardView({
issueMap={issueMapRef.current}
childProgressMap={childProgressMap}
myIssuesOpts={myIssuesOpts}
projectId={projectId}
/>
))}
@@ -317,12 +321,14 @@ function PaginatedBoardColumn({
issueMap,
childProgressMap,
myIssuesOpts,
projectId,
}: {
status: IssueStatus;
issueIds: string[];
issueMap: Map<string, Issue>;
childProgressMap?: Map<string, ChildProgress>;
myIssuesOpts?: { scope: string; filter: MyIssuesFilter };
projectId?: string;
}) {
const { loadMore, hasMore, isLoading, total } = useLoadMoreByStatus(
status,
@@ -335,6 +341,7 @@ function PaginatedBoardColumn({
issueMap={issueMap}
childProgressMap={childProgressMap}
totalCount={total}
projectId={projectId}
footer={
hasMore ? (
<InfiniteScrollSentinel onVisible={loadMore} loading={isLoading} />

View File

@@ -25,6 +25,7 @@ export function ListView({
childProgressMap = EMPTY_PROGRESS_MAP,
myIssuesScope,
myIssuesFilter,
projectId,
}: {
issues: Issue[];
visibleStatuses: IssueStatus[];
@@ -32,6 +33,8 @@ export function ListView({
/** When set, per-status load-more targets the scoped cache instead of the workspace one. */
myIssuesScope?: string;
myIssuesFilter?: MyIssuesFilter;
/** When set, the per-section "+" pre-fills the project on the create form. */
projectId?: string;
}) {
const sortBy = useViewStore((s) => s.sortBy);
const sortDirection = useViewStore((s) => s.sortDirection);
@@ -86,6 +89,7 @@ export function ListView({
issues={issuesByStatus.get(status) ?? []}
childProgressMap={childProgressMap}
myIssuesOpts={myIssuesOpts}
projectId={projectId}
/>
))}
</Accordion.Root>
@@ -98,11 +102,13 @@ function StatusAccordionItem({
issues,
childProgressMap,
myIssuesOpts,
projectId,
}: {
status: IssueStatus;
issues: Issue[];
childProgressMap: Map<string, ChildProgress>;
myIssuesOpts?: { scope: string; filter: MyIssuesFilter };
projectId?: string;
}) {
const { t } = useT("issues");
const selectedIds = useIssueSelectionStore((s) => s.selectedIds);
@@ -153,7 +159,7 @@ function StatusAccordionItem({
onClick={() =>
useModalStore
.getState()
.open("create-issue", { status })
.open("create-issue", { status, ...(projectId ? { project_id: projectId } : {}) })
}
/>
}

View File

@@ -182,6 +182,7 @@ function ProjectIssuesContent({
childProgressMap={childProgressMap}
myIssuesScope={scope}
myIssuesFilter={filter}
projectId={projectId}
/>
) : (
<ListView
@@ -190,6 +191,7 @@ function ProjectIssuesContent({
childProgressMap={childProgressMap}
myIssuesScope={scope}
myIssuesFilter={filter}
projectId={projectId}
/>
)}
</div>