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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions stories/src/table/with-dimension-locking.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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!

) {
if (!result.destination) {
return;
}

Expand Down