@dhis2-ui/portal
Advanced tools
Comparing version 8.14.5 to 8.14.6
@@ -24,4 +24,6 @@ "use strict"; | ||
* As a fallback, portals will be attached to the document body. | ||
* | ||
* This needs to be a function so that it works in tests as well. | ||
*/ | ||
const defaultNode = document.getElementById('dhis2-portal-root') || document.body; | ||
const getDefaultNode = () => document.getElementById('dhis2-portal-root') || document.body; | ||
@@ -36,3 +38,3 @@ const Portal = _ref => { | ||
(0, _react.useEffect)(() => { | ||
setMountNode(node || defaultNode); | ||
setMountNode(node || getDefaultNode()); | ||
}, [node]); | ||
@@ -39,0 +41,0 @@ |
@@ -12,5 +12,8 @@ import PropTypes from 'prop-types'; | ||
* As a fallback, portals will be attached to the document body. | ||
* | ||
* This needs to be a function so that it works in tests as well. | ||
*/ | ||
const defaultNode = document.getElementById('dhis2-portal-root') || document.body; | ||
const getDefaultNode = () => document.getElementById('dhis2-portal-root') || document.body; | ||
export const Portal = _ref => { | ||
@@ -24,3 +27,3 @@ let { | ||
useEffect(() => { | ||
setMountNode(node || defaultNode); | ||
setMountNode(node || getDefaultNode()); | ||
}, [node]); | ||
@@ -27,0 +30,0 @@ |
{ | ||
"name": "@dhis2-ui/portal", | ||
"version": "8.14.5", | ||
"version": "8.14.6", | ||
"description": "UI Portal", | ||
@@ -5,0 +5,0 @@ "repository": { |
3935
85