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

now calling dimension publisher first when drag is ending #382

Merged
merged 1 commit into from
Mar 13, 2018
Merged
Changes from all commits
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
12 changes: 11 additions & 1 deletion src/view/drag-drop-context/drag-drop-context.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ export default class DragDropContext extends React.Component<Props> {
this.styleMarshal.onPhaseChange(current);
}

const isDragEnding: boolean = current.phase !== 'DRAGGING' && previousInThisExecution.phase === 'DRAGGING';

// in the case that a drag is ending we need to instruct the dimension marshal
// to stop listening to changes. Otherwise it will try to process
// changes after the reorder in onDragEnd
if (isDragEnding) {
this.dimensionMarshal.onPhaseChange(current);
}

// We recreate the Hook object so that consumers can pass in new
// hook props at any time (eg if they are using arrow functions)
const hooks: Hooks = {
Expand All @@ -183,7 +192,8 @@ export default class DragDropContext extends React.Component<Props> {
// create new actions that update the application state. That will cause
// this subscription function to be called again before the next line is called.

if (isPhaseChanging) {
// if isDragEnding we have already called the marshal
if (isPhaseChanging && !isDragEnding) {
this.dimensionMarshal.onPhaseChange(current);
}

Expand Down