Files
kandev/apps/web/components/task-create-dialog-locked-fields.ts
T
José Almeida 68c94dfa3a feat: refine workbench chrome (#761)
* docs: define product and design direction

* style: establish restrained workbench primitives

* refactor: declutter board and task topbars

* style: align dockview panel chrome

* fix: align task topbar vcs control sizing

* refactor: surface integrations navigation

* fix: repair integrations and task creation workflow

* refactor: include linear in integrations navigation

* style: restore familiar workbench tones

* fix: add dockview tab breathing room

* fix: show configured integration shortcuts

* fix: hover open integrations menu

* fix: stabilize integrations hover menu

* fix: align home and dockview topbars

* fix: normalize home topbar controls

* fix: compact home topbar height

* fix: simplify home chrome and split buttons

* fix: move integrations to left chrome

* fix: restore home stats shortcut

* fix: add dockview tab breathing room

* fix: border home stats button

* fix: streamline dockview topbar actions

* fix: align task split button seam

* fix: address review feedback

* fix: restore topbar e2e affordances

* fix: stabilize workflow e2e isolation

* fix: add task topbar action overflow

* fix: address PR review feedback
2026-05-01 21:02:41 +01:00

43 lines
1.1 KiB
TypeScript

"use client";
import { useEffect } from "react";
import type {
DialogFormState,
TaskCreateDialogInitialValues,
} from "@/components/task-create-dialog-types";
type LockedFieldFormState = Pick<
DialogFormState,
| "selectedWorkflowId"
| "setSelectedWorkflowId"
| "repositoryId"
| "setRepositoryId"
| "branch"
| "setBranch"
>;
// Pushes late-arriving locked field values into form state when async feature
// wrappers resolve them after the dialog is already open.
export function useLockedFieldSync(
open: boolean,
workflowId: string | null,
initialValues: TaskCreateDialogInitialValues | undefined,
fs: LockedFieldFormState,
) {
const repoId = initialValues?.repositoryId;
const branch = initialValues?.branch;
useEffect(() => {
if (!open) return;
if (workflowId && workflowId !== fs.selectedWorkflowId) {
fs.setSelectedWorkflowId(workflowId);
}
if (repoId && repoId !== fs.repositoryId) {
fs.setRepositoryId(repoId);
}
if (branch && branch !== fs.branch) {
fs.setBranch(branch);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open, workflowId, repoId, branch]);
}