Skip to content

Commit

Permalink
BUGFIX: Prevent proptype warning regarding canBePasted property (#3900)
Browse files Browse the repository at this point in the history
If clipboardNodesContextPaths.length is 0, this part will be interpreted as false (because 0 is considered "falsy" in JavaScript). The entire expression will then be 0 without evaluating the second part. This happens due to short-circuit evaluation in JavaScript.

With this change we ensure that the value is always a boolean value.
  • Loading branch information
markusguenther authored Dec 13, 2024
1 parent 0e6c71c commit b628c59
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {selectors, actions} from '@neos-project/neos-ui-redux-store';

return (state, {contextPath}) => {
const clipboardNodesContextPaths = selectors.CR.Nodes.clipboardNodesContextPathsSelector(state);
const canBePasted = clipboardNodesContextPaths.length && (clipboardNodesContextPaths.every(clipboardNodeContextPath => {
const canBePasted = Boolean(clipboardNodesContextPaths.length && clipboardNodesContextPaths.every(clipboardNodeContextPath => {
return canBePastedSelector(state, {
subject: clipboardNodeContextPath,
reference: contextPath
Expand Down

0 comments on commit b628c59

Please sign in to comment.