diff --git a/applications/osb-portal/src/components/repository/RepositoryPageDetails.tsx b/applications/osb-portal/src/components/repository/RepositoryPageDetails.tsx index 0dc6c62f..ea67acee 100644 --- a/applications/osb-portal/src/components/repository/RepositoryPageDetails.tsx +++ b/applications/osb-portal/src/components/repository/RepositoryPageDetails.tsx @@ -140,12 +140,16 @@ const RepositoryPageDetails = ({ checkedChanged, user, onAction, + resetChecked, + setResetChecked }: { repository: OSBRepository; openRepoUrl: () => void; checkedChanged: (checked: RepositoryResourceNode[]) => any; user: UserInfo; onAction: (r: OSBRepository) => void; + resetChecked: boolean; + setResetChecked: (value: boolean) => any; }) => { const [currentPath, setCurrentPath] = React.useState< RepositoryResourceNode[] @@ -182,6 +186,7 @@ const RepositoryPageDetails = ({ } setChecked({ ...checked }); checkedChanged(Object.values(checked)); + setResetChecked(false); }; const addToCurrentPath = (n: RepositoryResourceNode) => { @@ -192,8 +197,10 @@ const RepositoryPageDetails = ({ if (value) { setChecked(resourcesListObject); checkedChanged(resourcesList); + setResetChecked(false); } else { setChecked({}); + checkedChanged([]) } }; @@ -209,6 +216,12 @@ const RepositoryPageDetails = ({ setRepositoryEditorOpen(false); }; + React.useEffect(() => { + if(resetChecked){ + setChecked({}) + } + },[resetChecked]) + return ( repository && ( { const [workspaceLink, setWorkspaceLink] = React.useState(null); const [error, setError] = React.useState(null); const [isLoading, setIsLoading] = React.useState(false); + const [resetChecked, setResetChecked] = React.useState(false); const canEdit = canEditRepository(props.user, props.repository); const [createdWorkspaceConfirmationContent, setCreatedWorkspaceConfirmationContent] = React.useState({ @@ -127,6 +128,7 @@ export const RepositoryPage = (props: any) => { if (showWorkspaceEditor) { setChecked([]); setRefresh(!refresh); + setResetChecked(true); } }; @@ -135,6 +137,7 @@ export const RepositoryPage = (props: any) => { if (showExistingWorkspaceEditor) { setChecked([]); setRefresh(!refresh); + setResetChecked(true); } }; @@ -401,6 +404,8 @@ export const RepositoryPage = (props: any) => { r && setRepository({ ...repository, ...r }) } user={user} + resetChecked={resetChecked} + setResetChecked={setResetChecked} /> )}