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

Fix for "Invariant Violation: Expected targetIds to be registered." #3431

Closed
wants to merge 1,398 commits into from

Conversation

marikobi
Copy link
Contributor

We keep seeing this error during drag and drop, and I believe it's happening because we give the list of targetIds to the async hover function and expect that list to be correct when we actually execute it : see #3313 (review)

Moving the invariant check after removing non-matching Ids should fix it since if the targetId doesn't exist any more it'll be removed from the targetIds list.

Tested locally and this fix seems to be working.

Fixes #763, #3403

th3fallen and others added 30 commits May 21, 2020 14:16
* make handleTopDragStart public for extension

Make handleTopDragStart public for extension for additional modifier key support.

* feat: make event handlers of the HTML5Backend public for clients extending it

Co-authored-by: Chris Trevino <darthtrevino@users.noreply.github.com>
Co-authored-by: Chris Trevino <chtrevin@microsoft.com>
* replace tab indent to 2 spaces indent

* remove redundant comma

Co-authored-by: Chris Trevino <darthtrevino@users.noreply.github.com>
…2423)

* fix(react-dnd): fix drag preview unsubscribe not called

* docs: add preview memory-leak to docsite

* fix: update spelling file

* fix(react-dnd): fix DragPreviewImage not calling cleanup hooks

* fix(react-dnd): remove depency array in DragPreviewImage useEffect

Co-authored-by: Chris Trevino <darthtrevino@users.noreply.github.com>
Co-authored-by: Chris Trevino <chtrevin@microsoft.com>
…-dnd#2475)

Bumps [gatsby-transformer-sharp](https://github.com/gatsbyjs/gatsby/tree/HEAD/packages/gatsby-transformer-sharp) from 2.5.2 to 2.5.3.
- [Release notes](https://github.com/gatsbyjs/gatsby/releases)
- [Changelog](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-transformer-sharp/CHANGELOG.md)
- [Commits](https://github.com/gatsbyjs/gatsby/commits/gatsby-transformer-sharp@2.5.3/packages/gatsby-transformer-sharp)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Chris Trevino <darthtrevino@users.noreply.github.com>
…-dnd#2474)

Bumps [gatsby-plugin-typescript](https://github.com/gatsbyjs/gatsby/tree/HEAD/packages/gatsby-plugin-typescript) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/gatsbyjs/gatsby/releases)
- [Changelog](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-typescript/CHANGELOG.md)
- [Commits](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-typescript@2.4.3/packages/gatsby-plugin-typescript)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
…2472)

Bumps [gatsby-plugin-sharp](https://github.com/gatsbyjs/gatsby/tree/HEAD/packages/gatsby-plugin-sharp) from 2.6.2 to 2.6.9.
- [Release notes](https://github.com/gatsbyjs/gatsby/releases)
- [Changelog](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sharp/CHANGELOG.md)
- [Commits](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-sharp@2.6.9/packages/gatsby-plugin-sharp)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* feat: add a profile() function to the html5backend

* feat: add profile() function to touch backend; add profile() to Backend interface

* feat: add profile() to testBackend impl

* build: update named backend exports

* build: update module/target for jest tests

* test: correct umd testing of touchbackend imports/exports

* test: add some profiling tests to HTML5Backend, TouchBackend
* docs: move regressions to new example section

* docs: only render regression cases in debug  mode

* docs: add localstorage flag for touchbackend in docs
* feat: improve typings in touchbackend

* build: remove default exports from dnd-core react-dnd

* feat: remove default exports from backends

* refactor: reduce default exports in decorator examples

* fix: correct import

* refactor: remove default exports from hooks examples

* refactor: use component memoization in docsite

* docs: get docs up

* fix: linting corrections

* build: re-enable lint rule regarding non-null assertions

* build: prune eslint rule disables

* refactor: update backend named exports to not have 'factory' in name

* fix: ts issues

* fix: ts, test issues

* fix: test
* docs: update backend import documentation

* v11.0.0

* chore: update changelog

* chore: add a note about breaking changes
example:
```
interface MyComponentProps {
    ...
}
export const MyComponent: FC<MyComponentProps> = (props: MyComponentProps) => {
    ...
}

/**
* error. TS2345: Argument of Type FC<MyComponentProps> is not assignable
* to parameter of type ComponentType<{}>
**/
const DndWrapper = wrapInTestContext(MyComponent);
```

This error happens because of this type definition in @types/react:
```
// from @types/react
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
```

We need to add <any> type in "React.ComponentType<any>" because without it default props type is empty object "{}"
Co-authored-by: Chris Trevino <darthtrevino@users.noreply.github.com>
dependabot bot and others added 28 commits March 4, 2021 23:52
* refactor: useDrop ergonomics changes

* spec.type is required
* spec.item is optional, and may be an object or function. This replaces the spec.begin() function.

* refactor: restore dropResult generic to useDrag

* feat: improve DragSourceMonitor typings

* feat: block beginDrag() in dnd-core if dragItem is nullish

* chore: cut semver

* fix: update getItem() type

* fix: update native hooks examples

* fix: some tests

* fix: tests

* fix: issue with dustbin stresstest

* fix: liveness issue with monitor output

* fix: liveness issue with monitor output

* fix: minor test correction

* fix: restore the ability to use spec.item with a type field and the begin() hook

* fix: remove .begin from useDrag types

* fix: update types

* docs: change "ES6 Symbol" language to "symbol"
* fix: simplify useDragType

* chore: cut semver

* fix: test update
* fix: dragaround-naive example stale closure issue

* chore: cut semver
* feat: add warning message to useDrag when clients use `spec.begin`

* test: add test for 'begin' error message

* chore: cut semver
* Update HooksOverview.md

It appears that the isActive variable does not exist in this scope so I assume the intended one was  `isOver`.

* Update HooksOverview.md
…#3271)

The isNodeInDocument function is used to check if a node was detached
during a drag event. It checks to make sure this `this.document.body` is
defined, but then checks if `document.body` contains the given node.

When used within an iframe, `document` in the global context may not be
the same as `this.document`. This commit updates the check to use
`this.document.body`.
* Fix typo 'craeted'

* Fix typo 'interations'
* use yarn 3

* remove dependabot

* update build tooling

* cut semver doc

* upgrade yarn sdks, run prettier

* update pkg.json

* ci: remove pretty-quick

* chore: update prettier

* ci: clean up scripts

* chore: run prettier

* chore: update prettierignore

* ci: update ignorefiles

* chore: update semver

* ci: add node 16.x

* ci: remove automerge step

* ci: update git-is-clean
* fix: add hook disconnection in effect callback cleanup

* chore: cut semver doc
* refactor: improve touchbackend opts

* fix: touchBackendImple event wiring

* chore: cut semver doc
…rops (react-dnd#3272)

* Fixes react-dnd#3179 - handle custom drag sources triggering native drops

* Include version update
* chore: upgrade to jest 27

* chore: cut semver

* fix: formatting

* chore: update semver
* chore: update testing library

* chore: describe semver
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.

Invariant Violation: Expected targetIds to be registered.