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

build(deps): bump react-dnd from 13.1.1 to 14.0.1 #1940

Closed
wants to merge 1 commit into from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 15, 2021

Bumps react-dnd from 13.1.1 to 14.0.1.

Release notes

Sourced from react-dnd's releases.

14.0.1

Patch

Update internal hook useDragType() to align with updated typings. Check 14.0.0 release for API changes

14.0.0

This release addresses a handful of nagging liveness and ergonomic issues with the hooks API.

The liveness issues affect all hooks, and were discovered on deeper inspection of certain stress tests in the documentation. The internal useCollector() hook is used to collect props from the DnD system when things change. Prior to this update, we subscribed to updates from the DnD monitor to trigger prop collection. However, state on the react side was only accounted for on the first render. This release improves that liveness by collecting props whenever react state changes.

The ergonomics of the useDrag have been refactored. In short:

  • spec.type is required
  • spec.item can be a function or static object.
  • The function version of spec.item replaces spec.begin

Since the release of the hooks API, we packed type under spec.item. However, this led to nonintuitive situations where an item field was required to be specified even though items are created in the begin method.

Additionally, in the original React-DnD design, beginDrag() was optional and the type of the draggables had to be defined. If no explicit DragObject was created, an implicit object was created by the system..

The change we've made here decouples type from item, and collapses begin into item.

// Pre-v14
useDrag({
   // item defined here to get a type
   item: { type: BOX } },
   // ...but the actual item is created here
   begin: () => ({ id })
})
// v14
useDrag({
type: BOX,
item: () => ({id})
})

e.g. useDrag({ item: { type: BOX }}) => useDrag({ type: 'BOX' })

We've also added the ability to cancel drag operations in the hooks API by returning null from begin.

// new API
useDrag({
  type: BOX,
  item: () => shouldNotDrag ? null : {id},
})
Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually

@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Mar 15, 2021
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/react-dnd-14.0.1 branch from 5f7c788 to d2a04f2 Compare March 15, 2021 15:01
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/react-dnd-14.0.1 branch from d2a04f2 to d29839e Compare March 15, 2021 15:16
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Mar 15, 2021

Looks like react-dnd is up-to-date now, so this is no longer needed.

@dependabot dependabot bot closed this Mar 15, 2021
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/react-dnd-14.0.1 branch March 15, 2021 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants