Skip to content

Commit

Permalink
fix: dispatch SET_PROJECT on open pipeline
Browse files Browse the repository at this point in the history
Otherwise the pipeline editor gets confused sometimes
  • Loading branch information
mausworks committed Jan 16, 2023
1 parent 314e8ff commit 08e6b00
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useProjectsApi } from "@/api/projects/useProjectsApi";
import { IconButton } from "@/components/common/IconButton";
import { ProjectContextMenu } from "@/components/common/ProjectContextMenu";
import { useProjectsContext } from "@/contexts/ProjectsContext";
import { useNavigate } from "@/hooks/useCustomRoute";
import { Project } from "@/types";
import { paginate } from "@/utils/array";
Expand All @@ -21,6 +22,7 @@ const ENTRIES_PER_PAGE = 10;
export const ProjectTable = () => {
const navigate = useNavigate();
const projectMap = useProjectsApi((api) => api.projects);
const { dispatch } = useProjectsContext();
const hasData = projectMap !== undefined;

const [menuAnchorEl, setMenuAnchorEl] = React.useState<HTMLElement>();
Expand All @@ -34,6 +36,8 @@ export const ProjectTable = () => {
);

const openProject = (project: Project) => {
dispatch({ type: "SET_PROJECT", payload: project.uuid });

navigate({
route: "pipeline",
sticky: false,
Expand Down

0 comments on commit 08e6b00

Please sign in to comment.