Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type PublishTargetsProps = {
export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
const { projectId, scrollToSectionId = '' } = props;
const { publishTargets } = useRecoilValue(settingsState(projectId));
const { getPublishTargetTypes, setPublishTargets } = useRecoilValue(dispatcherState);
const { setPublishTargets } = useRecoilValue(dispatcherState);
const publishTypes = useRecoilValue(publishTypesState(projectId));

const [showPublishDialog, setShowingPublishDialog] = useState(false);
Expand All @@ -90,12 +90,6 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
}
}, [location, publishTargets]);

useEffect(() => {
if (projectId) {
getPublishTargetTypes(projectId);
}
}, [projectId]);

useEffect(() => {
if (publishTargetsRef.current && scrollToSectionId === '#addNewPublishProfile') {
publishTargetsRef.current.scrollIntoView({ behavior: 'smooth' });
Expand Down
13 changes: 0 additions & 13 deletions Composer/packages/client/src/pages/publish/Publish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const Publish: React.FC<RouteComponentProps<{ projectId: string; targetName?: st
const {
getPublishHistory,
getPublishStatusV2,
getPublishTargetTypes,
setPublishTargets,
publishToTarget,
setQnASettings,
Expand Down Expand Up @@ -105,18 +104,6 @@ const Publish: React.FC<RouteComponentProps<{ projectId: string; targetName?: st
return currentBotList.filter((bot) => checkedSkillIds.some((id) => bot.id === id));
}, [checkedSkillIds]);

// The publishTypes are loaded from the server and put into the publishTypesState per project
// The botProjectSpaceSelector maps the publishTypes to the project bots.
// The localBotsDataSelector uses botProjectSpaceSelector
// The botPropertyData uses localBotsDataSelector
// When the botPropertyData is used (like in the canPull method), the publishTypes must be loaded for the current project.
// Otherwise the botPropertyData publishTypes will always be empty and this component won't function properly.
useEffect(() => {
if (projectId) {
getPublishTargetTypes(projectId);
}
}, [projectId]);

const canPull = useMemo(() => {
return selectedBots.some((bot) => {
const { publishTypes, publishTargets } = botPropertyData[bot.id];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ export const openRootBotAndSkills = async (callbackHelpers: CallbackInterface, d

set(botNameIdentifierState(rootBotProjectId), camelCase(name));
set(botProjectIdsState, [rootBotProjectId]);
// Get the publish types on opening
dispatcher.getPublishTargetTypes(rootBotProjectId);
// Get the status of the bot on opening if it was opened and run in another window.
dispatcher.getPublishStatus(rootBotProjectId, defaultPublishConfig);
if (botFiles?.botProjectSpaceFiles?.length) {
Expand Down