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

Remove duplicate code in dimension locking example #1637

Merged
merged 2 commits into from
Nov 29, 2019

Conversation

CraigEge
Copy link
Contributor

The same boolean check is performed twice, once after the other.

This cleans up the example for readability and to fix redundancy.

The same boolean check is performed twice, once after the other.

This cleans up the example for readability and to fix redundancy.
@@ -191,10 +191,7 @@ export default class TableApp extends Component<AppProps, AppState> {
});

// dropped outside the list
if (
!result.destination ||
result.destination.index === result.source.index
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is possible to move an item back into the same spot. The check result.destination.index === result.source.index will exit early if that is the case

Copy link
Contributor Author

@CraigEge CraigEge Nov 28, 2019

Choose a reason for hiding this comment

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

If you check the lines just below it, the same check occurs, making it redundant. https://github.com/atlassian/react-beautiful-dnd/blob/master/stories/src/table/with-dimension-locking.jsx#L194-L204

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh i see now!

@alexreardon alexreardon merged commit cf5c727 into atlassian:master Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants