@schibsted/niche-ads
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -0,1 +1,7 @@ | ||
### [0.3.2](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v0.3.1...v0.3.2) (2021-12-15) | ||
### Bug Fixes | ||
- fix clearplacenets reloading ([#14](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/14)) ([4951993](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/4951993a91ac2d4d7011bdaaa7ca608df4833857)) | ||
### [0.3.1](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v0.3.0...v0.3.1) (2021-12-14) | ||
@@ -2,0 +8,0 @@ |
@@ -66,5 +66,9 @@ "use strict"; | ||
const [adScriptsReady, setAdScriptsReady] = (0, _react.useState)(false); | ||
const placementsConfigRef = (0, _react.useRef)(); | ||
const placementsMediation = (0, _react.useRef)({}); | ||
const retryLoadAds = (0, _react.useRef)(false); | ||
const scriptsLoadPromise = (0, _react.useRef)(); | ||
(0, _react.useEffect)(() => { | ||
placementsConfigRef.current = placementsConfig; | ||
}, [placementsConfig]); | ||
const adReadyObserver = (0, _react.useCallback)(ready => { | ||
@@ -198,3 +202,3 @@ setAdScriptsReady(ready); | ||
const clearPlacements = (0, _react.useCallback)(() => { | ||
placementsConfig.forEach(placementConfig => { | ||
placementsConfigRef.current.forEach(placementConfig => { | ||
cleanUpPlacement(placementConfig.targetId); | ||
@@ -204,3 +208,3 @@ }); | ||
setPlacementsConfig([]); | ||
}, [placementsConfig]); | ||
}, []); | ||
const value = (0, _react.useMemo)(() => ({ | ||
@@ -207,0 +211,0 @@ loadAds, |
{ | ||
"name": "@schibsted/niche-ads", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Package containing ads logic reappearing across our projects", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -49,2 +49,3 @@ import { createContext, useCallback, useMemo, useState, useRef, useEffect } from 'react'; | ||
const [adScriptsReady, setAdScriptsReady] = useState(false); | ||
const placementsConfigRef = useRef(); | ||
const placementsMediation = useRef({}); | ||
@@ -54,2 +55,6 @@ const retryLoadAds = useRef(false); | ||
useEffect(() => { | ||
placementsConfigRef.current = placementsConfig; | ||
}, [placementsConfig]); | ||
const adReadyObserver = useCallback((ready) => { | ||
@@ -190,3 +195,3 @@ setAdScriptsReady(ready); | ||
const clearPlacements = useCallback(() => { | ||
placementsConfig.forEach((placementConfig) => { | ||
placementsConfigRef.current.forEach((placementConfig) => { | ||
cleanUpPlacement(placementConfig.targetId); | ||
@@ -197,3 +202,3 @@ }); | ||
setPlacementsConfig([]); | ||
}, [placementsConfig]); | ||
}, []); | ||
@@ -200,0 +205,0 @@ const value = useMemo( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67282
1160