export interface ProjectBranchesAppProps {
component: Component;
+ fetchComponent: () => Promise<void>;
}
function ProjectBranchesApp(props: ProjectBranchesAppProps) {
- const { component } = props;
+ const { component, fetchComponent } = props;
return (
<div className="page page-limited" id="project-branch-like">
<LifetimeInformation />
</header>
- <BranchLikeTabs component={component} />
+ <BranchLikeTabs component={component} fetchComponent={fetchComponent} />
</div>
);
}
interface Props {
component: Component;
+ fetchComponent: () => Promise<void>;
}
export enum Tabs {
];
export default function BranchLikeTabs(props: Props) {
- const { component } = props;
+ const { component, fetchComponent } = props;
const [currentTab, setCurrentTab] = useState<Tabs>(Tabs.Branch);
const [renaming, setRenaming] = useState<BranchLike>();
const [settingAsMain, setSettingAsMain] = useState<Branch>();
setSettingAsMain(undefined);
};
- const handleSetAsMainBranch = (branchLike: BranchLike) => {
+ const handleSetAsMainBranch = () => {
+ handleClose();
+ fetchComponent();
+ };
+
+ const handleSetAsMainBranchOption = (branchLike: BranchLike) => {
if (isBranch(branchLike)) {
setSettingAsMain(branchLike);
}
displayPurgeSetting={isBranchMode}
onDelete={setDeleting}
onRename={setRenaming}
- onSetAsMain={handleSetAsMainBranch}
+ onSetAsMain={handleSetAsMainBranchOption}
title={title}
/>
</div>
{settingAsMain && !isMainBranch(settingAsMain) && (
<SetAsMainBranchModal
- branch={settingAsMain}
component={component}
+ branch={settingAsMain}
onClose={handleClose}
- onSetAsMain={handleClose}
+ onSetAsMain={handleSetAsMainBranch}
/>
)}
</>
onComponentChange: (changes: Partial<Component>) => {
setRealComponent({ ...realComponent, ...changes });
},
+ fetchComponent: jest.fn(),
component: realComponent,
...omit(componentContext, 'component'),
}}