Skip to content

Commit

Permalink
fix initial value for prebuildBranchPattern
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Sep 20, 2023
1 parent 2d70a71 commit f20fa8b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions components/dashboard/src/projects/ProjectSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Project, ProjectSettings } from "@gitpod/gitpod-protocol";
import { useCallback, useContext, useState, Fragment, useMemo } from "react";
import { useCallback, useContext, useState, Fragment, useMemo, useEffect } from "react";
import { useHistory } from "react-router";
import { CheckboxInputField } from "../components/forms/CheckboxInputField";
import { PageWithSubMenu } from "../components/PageWithSubMenu";
Expand Down Expand Up @@ -57,9 +57,14 @@ export default function ProjectSettingsView() {
const history = useHistory();
const refreshProjects = useRefreshProjects();
const { toast } = useToast();
const [prebuildBranchPattern, setPrebuildBranchPattern] = useState<string>(
project?.settings?.prebuildBranchPattern || "",
);
const [prebuildBranchPattern, setPrebuildBranchPattern] = useState("");

useEffect(() => {
if (!project) {
return;
}
setPrebuildBranchPattern(project?.settings?.prebuildBranchPattern || "");
}, [project]);

const setProjectName = useCallback(
(projectName: string) => {
Expand Down

0 comments on commit f20fa8b

Please sign in to comment.