Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!!FEATURE: (Neos.Neos) Track created nodes in PendingChangesProjection #4393

Merged

Conversation

grebaldi
Copy link
Contributor

@grebaldi grebaldi commented Jul 8, 2023

refs: #4024

This is an attempt to fix an issue that came up with neos/neos-ui#3569.

The E2E Tests for the UI try to discard a document that has just been created (without having been published) and that the user is currently viewing. When this happens, it is expected that the user will be redirected to the next-best document that can be viewed.

Instead, the UI failed to update the page tree and reloaded the guest frame, which then showed an error message of the form:

TODO: SITE NOT FOUND; should not happen (for address NodeAddress[contentStream=9ce2581c-6e0a-467a-ad33-37c7133ce3a2, dimensionSpacePoint={"language":"en_US"}, nodeAggregateId=6b0b30db-933b-4c3d-b47b-0a7beed6c315, workspaceName=user-admin]

@ahaeslich had pointed me via Slack to #4024, where she had described this very behavior.

Looking into it, I had found that the UI simply had no idea which nodes have been removed through the discard-operation.

I then found the PendingChangesProjection mechanism here in Neos.Neos. I modified the projection to track every node that has been created within a workspace.

neos/neos-ui@f692333 (or more concretely: https://github.com/neos/neos-ui/blob/f6923332edf5a125ab42ac9c56500b6604e0c1d1/Classes/ContentRepository/Service/WorkspaceService.php#L159-L204) shows how that information is used to retrieve the nodes that have been removed through discard.

I'm new to the projection business, so I have no idea if what I came up here is any good. I'm looking forward to your reviews :)

@github-actions github-actions bot added the 9.0 label Jul 8, 2023
grebaldi added a commit to neos/neos-ui that referenced this pull request Jul 8, 2023
Using the `PendingChangesProjection` from Neos.Neos, which after
neos/neos-development-collection#4393 will track all
nodes that have been newly created within the workspace that contains the
change set that is being discarded.
In Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php:

This moves most of the repeated code from the methods `markAsChanged`,
`markAsCreated` and `markAsMoved` into a unified `modifyChange` method
that accepts a callback for the aforementioned methods to perform their
unique tasks in.
@grebaldi grebaldi marked this pull request as ready for review July 8, 2023 15:03
@skurfuerst
Copy link
Member

Sorry for the long delay. On the first sight, this looks good to me :) I'd suggest that we discuss it in an upcoming weekly, and then IMHO it is likely this can be merged!

All the best,
Sebastian

@skurfuerst
Copy link
Member

I just merged origin/9.0 here into this branch and fixed the conflicts (I hope correctly :) @grebaldi do you want to have a look again as well?)

When the CI is green, IMHO this is merge ready.

All the best,
Sebastian

Copy link
Member

@skurfuerst skurfuerst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 by reading

Copy link
Member

@skurfuerst skurfuerst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again some detailed testing and a minor fix (introduced by the rebase); merging now.

@skurfuerst skurfuerst merged commit 84b49fd into neos:9.0 Aug 2, 2023
@skurfuerst skurfuerst added this to the 9.0 (ES CR) milestone Aug 2, 2023
grebaldi added a commit to neos/neos-ui that referenced this pull request Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants