Open rosspbauer opened 5 years ago
Hi, you are right, as described in the doc autoReload will call DFPmanager.reload() under the hood, so the ads will be destroyed and created again:
http://react-dfp.ml/dfpslotsprovider/autoreload/ http://react-dfp.ml/dfpmanager/reload/
On the other hand, the behavior you expect can be achieved by calling the method DFPManger.refresh(): http://react-dfp.ml/dfpmanager/refresh/. There is one issue though, just checked the code real quick and I think DFPSlotsProviding is not re-rendering when updating the targetingArguments prop, so given we pass targeting attributes via context the AdSlots are not gonna be updated w the new targeting variables (https://github.com/jaanauati/react-dfp/blob/master/js/dfpslotsprovider.js#L222, https://github.com/jaanauati/react-dfp/blob/master/js/dfpslotsprovider.js#L98, https://github.com/jaanauati/react-dfp/blob/master/js/dfpslotsprovider.js#L144).
This is a bug and we'll need a pull request to get it fixed, as a workaround i'd suggest you to programmatically call DFPManager.setTargetingArguments(...)
and DFPManager.refresh()
to update targeting arguments and refresh all the slots in the page:
http://react-dfp.ml/dfpmanager/settargetingarguments/ http://react-dfp.ml/dfpmanager/refresh/
I'll keep this ticket opened until we can the bug fixed, please let me know if the workaround worked for you.
thanks
Hi @jaanauati looks like this issue with DFPSlotsProviding not re-rendering when updating the targetingArguments prop is still happening, so none of the targeting arguments are updating. The workaround is not working for me, do you know if the DFPSlotsProviding was ever re-rendering / working as expected? I tried to use version 0.10.0
, but the issue seems to be the same. I had a quick look and it seems the context is updating correctly.
Im setting up the
DFPSlotsProvider
with theautoReload
prop set to{ adUnit: true, targetingArguments: true}
My expectation here is that when the prop values for the
adUnit
andtargetingArguments
changed the ads would be reloaded with the new prop values.What appears to happen is the original slots are destroyed and new ones are created with the values for the original slot that was generated (located in the
registeredSlots
object in the manager). Therefore the targeting of the new ads is not representative of the current set of props.Is this behaviour expected / a bug? and is there a way to reload the slots with the updated information?
Thanks