feat: apply new label to task when available
This commit is contained in:
parent
167d285d02
commit
5a9a66effe
@ -767,6 +767,7 @@ const ProjectBoard: React.FC<ProjectBoardProps> = ({ projectID, onCardLabelClick
|
||||
onLabelToggle={labelID => {
|
||||
toggleTaskLabel({ variables: { taskID: task.id, projectLabelID: labelID } });
|
||||
}}
|
||||
taskID={task.id}
|
||||
labelColors={data.labelColors}
|
||||
labels={labelsRef}
|
||||
taskLabels={taskLabelsRef}
|
||||
|
@ -8,11 +8,13 @@ import {
|
||||
FindProjectDocument,
|
||||
useCreateProjectLabelMutation,
|
||||
FindProjectQuery,
|
||||
useToggleTaskLabelMutation,
|
||||
} from 'shared/generated/graphql';
|
||||
import LabelManager from 'shared/components/PopupMenu/LabelManager';
|
||||
import LabelEditor from 'shared/components/PopupMenu/LabelEditor';
|
||||
|
||||
type LabelManagerEditorProps = {
|
||||
taskID?: string;
|
||||
labels: React.RefObject<Array<ProjectLabel>>;
|
||||
taskLabels: null | React.RefObject<Array<TaskLabel>>;
|
||||
projectID: string;
|
||||
@ -21,6 +23,7 @@ type LabelManagerEditorProps = {
|
||||
};
|
||||
|
||||
const LabelManagerEditor: React.FC<LabelManagerEditorProps> = ({
|
||||
taskID,
|
||||
labels: labelsRef,
|
||||
projectID,
|
||||
labelColors,
|
||||
@ -29,7 +32,13 @@ const LabelManagerEditor: React.FC<LabelManagerEditorProps> = ({
|
||||
}) => {
|
||||
const [currentLabel, setCurrentLabel] = useState('');
|
||||
const { setTab, hidePopup } = usePopup();
|
||||
const [toggleTaskLabel] = useToggleTaskLabelMutation();
|
||||
const [createProjectLabel] = useCreateProjectLabelMutation({
|
||||
onCompleted: data => {
|
||||
if (taskID) {
|
||||
toggleTaskLabel({ variables: { taskID, projectLabelID: data.createProjectLabel.id } });
|
||||
}
|
||||
},
|
||||
update: (client, newLabelData) => {
|
||||
updateApolloCache<FindProjectQuery>(
|
||||
client,
|
||||
|
@ -267,6 +267,7 @@ const Project = () => {
|
||||
onLabelToggle={labelID => {
|
||||
toggleTaskLabel({ variables: { taskID: task.id, projectLabelID: labelID } });
|
||||
}}
|
||||
taskID={task.id}
|
||||
labelColors={data.labelColors}
|
||||
labels={labelsRef}
|
||||
taskLabels={taskLabelsRef}
|
||||
|
Loading…
Reference in New Issue
Block a user