diff --git a/package.json b/package.json index fbcceb5a..5f431477 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/researchgate/react-intersection-list/issues" }, "dependencies": { - "@researchgate/react-intersection-observer": "^0.7.1", + "@researchgate/react-intersection-observer": "^0.7.3", "prop-types": "^15.6.1", "react-lifecycles-compat": "^3.0.4", "warning": "^4.0.1" diff --git a/src/Sentinel.js b/src/Sentinel.js index 0b045a2f..c14f777f 100644 --- a/src/Sentinel.js +++ b/src/Sentinel.js @@ -43,7 +43,8 @@ class Sentinel extends Component { // its threshold prematurely. In this case we don't get any update from the Observer instance. // We need to guarantee an update, and re-observing is a cheap way to accomplish this. if (currentRootMargin === rootMargin && currentRootElement === rootElement) { - this.element.reobserve(); + this.element.unobserve(); + this.element.observe(); return false; } return true; diff --git a/src/__tests__/Sentinel.spec.js b/src/__tests__/Sentinel.spec.js index ba3c9ff5..5fa3567d 100644 --- a/src/__tests__/Sentinel.spec.js +++ b/src/__tests__/Sentinel.spec.js @@ -69,7 +69,8 @@ describe('render', () => { const renderSpy = jest.spyOn(tree.getInstance(), 'render'); const spy = jest.fn(); tree.getInstance().element = { - reobserve: spy, + unobserve: spy, + observe: spy, }; tree.update(); expect(renderSpy).not.toBeCalled(); diff --git a/yarn.lock b/yarn.lock index a184f402..9af924f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -91,9 +91,9 @@ dependencies: "@researchgate/eslint-config-rg-base" "^2.0.0" -"@researchgate/react-intersection-observer@^0.7.1": - version "0.7.1" - resolved "https://registry.yarnpkg.com/@researchgate/react-intersection-observer/-/react-intersection-observer-0.7.1.tgz#c63d0d133d9f121fc34d5019dd5a0a4d3c87f32a" +"@researchgate/react-intersection-observer@^0.7.3": + version "0.7.3" + resolved "https://registry.yarnpkg.com/@researchgate/react-intersection-observer/-/react-intersection-observer-0.7.3.tgz#cef70feae9ccb33d5104fa8bf4c8c3ddc049d5fa" dependencies: invariant "^2.2.2" prop-types "^15.6.0"