-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
BUGFIX: Check for unapplied inspector changes before allowing focus change via <SelectedElement/>
#3501
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few naming nitpicks. Otherwise this works fine!
packages/neos-ui/src/Containers/RightSideBar/Inspector/SelectedElement/index.js
Show resolved
Hide resolved
packages/neos-ui/src/Containers/RightSideBar/Inspector/SelectedElement/index.js
Show resolved
Hide resolved
packages/neos-ui/src/Containers/RightSideBar/Inspector/SelectedElement/index.js
Show resolved
Hide resolved
packages/neos-ui/src/Containers/RightSideBar/Inspector/SelectedElement/index.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. i never expected that to be actually fixed, thank you for going through all the odd edge cases!!!
I will need to continue this review another time :)
@@ -41,6 +41,7 @@ export enum actionTypes { | |||
DISCARD = '@neos/neos-ui/UI/Inspector/DISCARD', | |||
ESCAPE = '@neos/neos-ui/UI/Inspector/ESCAPE', | |||
RESUME = '@neos/neos-ui/UI/Inspector/RESUME', | |||
ELEMENT_WAS_SELECTED = '@neos/neos-ui/UI/Inspector/ELEMENT_WAS_SELECTED', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const currentlyFocusedNodeContextPaths = | ||
selectors.CR.Nodes.focusedNodePathsSelector(store.getState()); | ||
|
||
if (currentlyFocusedNodeContextPaths.includes(contextPath)) { | ||
store.dispatch(actions.CR.Nodes.focus(contextPath, fusionPath)); | ||
store.dispatch(actions.UI.ContentCanvas.requestScrollIntoView(true)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems to be part of the second fix you mentioned that i dont really understand at first glance. But i will try some debugging and see if i can then make sense of those lines plus your description ;)
Closed in favor of #3491 |
fixes: #3174
The problem
#3174 describes a way to bypass the "Unapplied Changes"-dialog that is supposed to prevent the user from losing pending inspector changes.
The user can focus a different node by using the
<SelectedElement/>
container that is always at the top of the inspector:This works, because the "Unapplied Changes"-dialog is exclusively triggered by an overlay that appears, when there are pending changes, and covers the entire UI (after #3491 has been merged that is) except the inspector. Since the
<SelectedElement/>
container is part of the inspector, it is not covered by the overlay and thus allows the user to bypass the "Unapplied Changes"-dialog.The solution
The first part of the solution introduces a new redux action to the inspector state called
ELEMENT_WAS_SELECTED
. (The naming is up for discussion, since it introduces past-tense as opposed to imperatives - which is more correct but runs counter the established convention. It may or may not be a confusing name anyway though - idk)The inspector saga is then used to handle
ELEMENT_WAS_SELECTED
actions so that it first checks if there are pending changes in the inspector, triggers the "Unapplied Changes"-dialog if so, and - depending on the result of the latter - focuses the selected node or leaves the state untouched.The second part of the solution concerns the handling of the
Neos.Neos.Ui:ReloadContentOutOfBand
server feedback. I noticed that if I selected an element and then clicked on "apply" in the "Unapplied Changes"-dialog, the node I've selected would be focused for a brief moment, after which the UI jumped back to the previously focused node.The reason for this was, that the server feedback handler for
Neos.Neos.Ui:ReloadContentOutOfBand
wanted to re-focus the node it just reloaded, without checking whether it was still supposed to be focused. I added a check for that, so that no jumping occurs anymore.