Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
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
25 changes: 17 additions & 8 deletions Composer/packages/client/src/pages/publish/Publish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const Publish: React.FC<RouteComponentProps<{ projectId: string; targetName?: st
const {
getPublishHistory,
getPublishStatusV2,
getPublishTargetTypes,
setPublishTargets,
publishToTarget,
setQnASettings,
Expand Down Expand Up @@ -84,18 +85,26 @@ 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];
const type = publishTypes?.find(
(t) => t.name === publishTargets?.find((target) => target.name === bot.publishTarget)?.type
);
if (type?.features?.pull) {
return true;
}
return false;
const botPublishTarget = publishTargets?.find((target) => target.name === bot.publishTarget);
const type = publishTypes?.find((t) => t.name === botPublishTarget?.type);
return type?.features?.pull;
});
}, [selectedBots]);
}, [selectedBots, botPropertyData]);

const canPublish =
checkedSkillIds.length > 0 && !isPublishPending && selectedBots.some((bot) => Boolean(bot.publishTarget));
Expand Down