Skip to content

Commit

Permalink
BUGFIX: Only continue publishing if there are remaining changes after…
Browse files Browse the repository at this point in the history
… conflict resolution

Attempting to publish 0 changes after the adjustments in the core neos/neos-development-collection#5337 will throw an error and is also needless:

> The command "PublishIndividualNodesFromWorkspace" for workspace admin-admington must contain nodes to publish

To avoid unnecessary interaction - which is also tested by this test:

> Publish + Syncing: Create a conflict state between two editors, then try to publish and choose "Drop conflicting changes" as a resolution strategy during automatic rebase

We dont continue publishing if the publish button is not orange basically ;)

In the future i think this should be improved that another phase and screen is added so this is done more transparently.
  • Loading branch information
mhsdesign committed Jan 23, 2025
1 parent ff938de commit 384e0e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
28 changes: 21 additions & 7 deletions packages/neos-ui-sagas/src/Publish/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,30 @@ export function * watchPublishing({routes}: {routes: Routes}) {

if (conflictsWereResolved) {
yield put(actions.CR.Publishing.resolveConflicts());

//
// It may happen that after conflicts are resolved, the
// document we're trying to publish no longer exists.
// There are special cases after conflicts is resolved:
//
// * the document we're trying to publish no longer exists
// * the site we're trying to publish no longer contains changes
// * the document we're trying to publish no longer contains changes
//
// We need to finish the publishing operation in this
// case, otherwise it'll lead to an error.
// case, otherwise it'll lead to an error as there is nothing to do.
//
const publishingShouldContinue = scope === PublishingScope.DOCUMENT
? Boolean(yield select(selectors.CR.Nodes.byContextPathSelector(ancestorId)))
: true;
// todo possibly add another phase to actively continue publishing and also make it more transparently if publishing cant continue
// see: https://github.com/neos/neos-ui/issues/3908#issuecomment-2608232225
let publishingShouldContinue = true;
if (scope === PublishingScope.DOCUMENT) {
if (!(yield select(selectors.CR.Nodes.byContextPathSelector(ancestorId)))) {
publishingShouldContinue = false;
} else if ((yield select(selectors.CR.Workspaces.publishableNodesInDocumentSelector)).length === 0) {
publishingShouldContinue = false;
}
} else if (scope === PublishingScope.SITE) {
if ((yield select(selectors.CR.Workspaces.publishableNodesSelector)).length === 0) {
publishingShouldContinue = false;
}
}

if (publishingShouldContinue) {
yield * attemptToPublishOrDiscard();
Expand All @@ -141,6 +154,7 @@ export function * watchPublishing({routes}: {routes: Routes}) {
window.addEventListener('beforeunload', handleWindowBeforeUnload);
yield * attemptToPublishOrDiscard();
} catch (error) {
console.error(error); // log client site errors
yield put(actions.CR.Publishing.fail(error as AnyError));
} finally {
window.removeEventListener('beforeunload', handleWindowBeforeUnload);
Expand Down
1 change: 1 addition & 0 deletions packages/neos-ui-sagas/src/Sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const makeSyncPersonalWorkspace = (deps: {
yield put(actions.CR.Syncing.fail(result.error));
}
} catch (error) {
console.error(error); // log client site errors
yield put(actions.CR.Syncing.fail(error as AnyError));
} finally {
window.removeEventListener('beforeunload', handleWindowBeforeUnload);
Expand Down

0 comments on commit 384e0e6

Please sign in to comment.