Skip to content

Commit 2cb2a62

Browse files
committed
Merge branch 'cherry-pick-6fa2e470' into 'main'
Merge branch 'fix/websocket-progress-new-version-on-deploy' into 'next/4.0' See merge request aop/addons/axelor-public/axelor-studio!634
2 parents a743f4c + 12538b6 commit 2cb2a62

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

react/bpm/src/BPMN/Modeler/BpmnModeler.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,15 +1150,27 @@ function BpmnModelerComponent() {
11501150
);
11511151
return;
11521152
}
1153-
allowProgressBarDisplay && wsProgress.init(wkf.id);
1154-
await waitForConnection();
1153+
1154+
// Only initialize WebSocket if NOT creating a new version
1155+
// (will be initialized with new version ID after creation)
1156+
const willCreateNewVersion = newWkf?.newVersionOnDeploy && newWkf?.statusSelect === 2;
1157+
if (allowProgressBarDisplay && !willCreateNewVersion) {
1158+
wsProgress.init(wkf.id);
1159+
await waitForConnection();
1160+
}
1161+
11551162
try {
11561163
setProgress(0);
11571164
const { context, res } =
11581165
(await saveBeforeDeploy(wkfMigrationMap, isMigrateOld, newWkf)) || {};
1159-
if (newWkf?.newVersionOnDeploy && newWkf?.statusSelect === 2) {
1166+
if (willCreateNewVersion) {
11601167
let newVersionWkf = await addNewVersion(newWkf);
11611168
if (newVersionWkf && newVersionWkf.statusSelect === 1) {
1169+
// Initialize WebSocket with new model ID after creating new version
1170+
if (allowProgressBarDisplay) {
1171+
wsProgress.init(newVersionWkf.id);
1172+
await waitForConnection();
1173+
}
11621174
startAction(newVersionWkf, wkfMigrationMap, true, isMigrateOld);
11631175
}
11641176
} else {

src/main/java/com/axelor/studio/bpm/service/deployment/BpmDeploymentServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ private AtomicBoolean computeMigrationInstances(
449449
UnmigratedInstances++;
450450
}
451451

452-
if (isWebSocketSupported) {
452+
if (isWebSocketSupported && sessionId != null) {
453453
BpmDeploymentWebSocket.updateProgress(
454454
sessionId,
455455
calculateInstanceMigrationPercentage(iterationNumber, processInstanceIds.size()));

0 commit comments

Comments
 (0)